Adding background image control to a component requires only two steps: <View className="gifts" style={{ background: `url(${baseUrl}starMove/exclusiveEntrance/card.png) no-repeat`, backgroundSize: '100% 100%', }} > <View classname="gift-lists"></View> </View> Set background and backgroundSize. style={ width: 100%; height: 100%; } ps: Here is how to use CSS file to make the background image size adapt to the size of div Setting the background image attribute: background-size: cover; can make the background image adapt to the size of the div. background-size has 3 properties:
Summarize This is the end of this article about the implementation code of setting div background image with CSS. For more relevant CSS div background image content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! |
>>: SQL implementation of LeetCode (182. Duplicate mailboxes)
To export MySQL query results to csv , you usuall...
This article records the installation tutorial of...
Table of contents introduction Ideas Establish ID...
Table of contents uni-app Introduction HTML part ...
This article example shares the specific code of ...
The cut command in Linux and Unix is used to cu...
When modifying Magento frequently, you may encount...
Preface Nginx 's built-in module supports lim...
html2canvas is a library that generates canvas fr...
Introduction: AD is the abbreviation of Active Di...
1. Traditional binlog master-slave replication, s...
The Docker container that has been running shows ...
The best thing you can do for your data and compu...
This article introduces the method of using CSS3 ...
Purpose Understand the role of nextTick and sever...