Home >Web Front-end >CSS Tutorial >How to set the color of the body in css

How to set the color of the body in css

青灯夜游
青灯夜游Original
2021-11-02 15:10:358190browse

How to set the body color in css: 1. Use the "body{color: color value;}" statement to set the font color of the body; 2. Use the "body{background-color: color value;}" statement to set it The background color of the body.

How to set the color of the body in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css sets the font color of the body

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
body {
color: palevioletred;
}
</style>
</head>
<body>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
</body>
</html>

Rendering:

How to set the color of the body in css

Description: ## The

#color attribute specifies the color of the text.

This attribute sets the foreground color of an element (in HTML representation, the color of the element's text); raster images are not affected by color. This color also applies to all borders of the element, unless overridden by border-color or another border-color property.

css sets the background color of the body

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
body {
background-color: paleturquoise;
}
</style>
</head>
<body>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
<div>测试文本</div>
</body>
</html>

Rendering:

How to set the color of the body in css

Description:


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 sharing:

css video tutorial)

The above is the detailed content of How to set the color of the body 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