Home>Article>Web Front-end> How to set the size of html background image

How to set the size of html background image

coldplay.xixi
coldplay.xixi Original
2021-03-17 16:37:54 63966browse

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.

How to set the size of html background image

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".

How to set the size of html background image

2. Then set the background image for the label. Here I set the

label.

How to set the size of html background image

#3. Then create a new css file, as shown in the picture, I named it "1.css".

How to set the size of html background image

4. Set thebackground-sizeattribute for the body tag here. If your tag is a div, write div, and then you can set the width and height.

How to set the size of html background image

5. As shown in the picture, write this innew_file.html:You can set the size of the background image.

How to set the size of html background image

#6. Finally, preview it in the browser. This is only part of the background.

How to set the size of html background image

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is html hidden tag Next article:What is html hidden tag