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)
This article shares the specific code of js to ac...
The code looks like this: <!DOCTYPE html> &...
The display without the effect picture is just em...
Add a DOCTYPE to the page Since different browser...
The data URI scheme allows us to include data in a...
VMware Workstation is a powerful desktop virtual ...
Wildcard categories: %Percent wildcard: indicates...
The TextBox with the ReadOnly attribute will be di...
MongoDB is cross-platform and can be installed on...
This article example shares the specific code of ...
1. Remove backslashes through the "stripslas...
Table of contents Defining the HTML structure Inp...
After setting textarea input in Element UI to aut...
Table of contents 1. Brief description 2. Steps t...
This article mainly introduces the Mysql backup m...