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:
<body style="background-color: #cccccc;">
2. Background-image
Usebackground-image
Property sets the background image.
Syntax:
<body style="background-image: url('background.jpg');">
3. Background-repeat
Use background-repeat
Property controls how the background image is repeated.
Grammar:
<body style="background-image: url('background.jpg'); background-repeat: repeat;">
4. Background-position
Use background-position
Property controls the position of the background image.
Syntax:
<body style="background-image: url('background.jpg'); background-position: left top;">
5. Background size (background-size)
Use background-size
Property controls the size of the background image.
Syntax:
<body style="background-image: url('background.jpg'); background-size: 100% 100%;">
6. Background-attachment
Usebackground-attachment
Property controls whether the background image scrolls as the page scrolls.
Grammar:
<body style="background-image: url('background.jpg'); background-attachment: fixed;">
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!