Home > Web Front-end > Front-end Q&A > What is the attribute used to set the background color of the body element in html?

What is the attribute used to set the background color of the body element in html?

烟雨青岚
Release: 2020-06-20 16:42:05
Original
11302 people have browsed it

What is the attribute used to set the background color of the body element in html?

#What is the attribute used for the background color of the body element in html?

#The attribute of the body element used to set the background color is bgcolor.

Syntax:

The bgcolor attribute is used to specify the background color of the document

Example:

<html>
<body bgcolor="#E6E6FA">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>
Copy after login

Compatibility Notes

In HTML 4.01, the use of the bgcolor attribute of the body element is deprecated; in XHTML 1.0 Strict DTD, the body element is not supported bgcolor attribute.

Please use CSS instead.

CSS syntax:

Recommended tutorial: "HTML Tutorial"

The above is the detailed content of What is the attribute used to set the background color of the body element in html?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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