Set the web page background in HTML
You can set the web page background in HTML through the following methods:
1. Background-color
Use the background-color
property to set a uniform background color.
Syntax:
<code class="html"><body style="background-color: #cccccc;"></code>
2. Background-image
Usebackground-image
Property sets the background image.
Syntax:
<code class="html"><body style="background-image: url('background.jpg');"></code>
3. Background-repeat
Use background-repeat
Property controls how the background image is repeated.
Grammar:
<code class="html"><body style="background-image: url('background.jpg'); background-repeat: repeat;"></code>
4. Background-position
Use background-position
Property controls the position of the background image.
Syntax:
<code class="html"><body style="background-image: url('background.jpg'); background-position: left top;"></code>
5. Background size (background-size)
Use background-size
Property controls the size of the background image.
Syntax:
<code class="html"><body style="background-image: url('background.jpg'); background-size: 100% 100%;"></code>
6. Background-attachment
Usebackground-attachment
Property controls whether the background image scrolls as the page scrolls.
Grammar:
<code class="html"><body style="background-image: url('background.jpg'); background-attachment: fixed;"></code>
The above is the detailed content of How to make web page background in html. For more information, please follow other related articles on the PHP Chinese website!