How to make web page background in html

下次还敢
Release: 2024-04-05 11:51:17
Original
1265 people have browsed it

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>
Copy after login

2. Background-image

Usebackground-image Property sets the background image.

Syntax:

<code class="html"><body style="background-image: url('background.jpg');"></code>
Copy after login

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>
Copy after login

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>
Copy after login

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>
Copy after login

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>
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template