Home  >  Article  >  Web Front-end  >  How to make web page background in html

How to make web page background in html

下次还敢
下次还敢Original
2024-04-05 11:51:171225browse

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!

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