How to set the size of the html background image: First create a new HTML page and set the background image for the tag; then set the [background-size] attribute for the body tag; finally set the width and height on the div tag.
The operating environment of this tutorial: Windows 7 system, HBuilderX.3.0.5 version, DELL G3 computer.
How to set the size of html background image:
1. In fact, most HTML editor operations are the same. Today I will explain it with Hbuilder. First of all Create a new HTML page, named here "new_file.html".
2. Then set the background image for the label. Here I set the
label.#3. Then create a new css file, as shown in the picture, I named it "1.css".
4. Set the background-size
attribute for the body tag here. If your tag is a div, write div, and then you can set the width and height.
5. As shown in the picture, write this in new_file.html
: <link href="css/1.%20css" type="text/css" rel="stylesheet">
You can set the size of the background image.
#6. Finally, preview it in the browser. This is only part of the background.
Related learning recommendations: html video tutorial
The above is the detailed content of How to set the size of html background image. For more information, please follow other related articles on the PHP Chinese website!