Home  >  Article  >  Web Front-end  >  How to add background color to the entire page in css

How to add background color to the entire page in css

王林
王林Original
2020-11-13 13:57:008934browse

How to add a background color to the entire page in css: You can use the background-color attribute to add a background color, such as [background-color:yellow;]. The background-color property is used to set the background color of an element.

How to add background color to the entire page in css

The background-color property sets the background color of an element.

The background of an element is the total size of the element, including padding and borders (but not margins).

(Learning video tutorial: css video tutorial)

Attribute value:

  • color Specifies the background color.

  • transparent Specifies that the background color should be transparent. This is the default

  • inherit specifies the background color, which should be inherited from the parent element

Example:

body
{
    background-color:yellow;
}
h1
{
    background-color:#00ff00;
}
p
{
    background-color:rgb(255,0,255);
}

Related Recommended: CSS tutorial

The above is the detailed content of How to add background color to the entire page in css. 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