, where color-value is the color value to be set, such as hexadecimal code, color name or RGB value."/> , where color-value is the color value to be set, such as hexadecimal code, color name or RGB value.">
Home > Article > Web Front-end > How to use bgcolor in html
The bgcolor attribute is used to set the background color of HTML elements. It has been deprecated. It is recommended to use the CSS background-color attribute instead. The usage method is:
, where color-value is the color value to be set, such as hexadecimal code, color name or RGB value.
How to use the bgcolor attribute in HTML
The bgcolor attribute is used to set the background color of an HTML element. It is a deprecated property and it is recommended to use the CSS background-color property instead.
Usage
<code class="html"><element bgcolor="color-value"> ... </element></code>
Among them:
,
,
, etc.
) or a color name (such as
white) or RGB value (such as
rgb(255, 255, 255)).
Example
<code class="html"><body bgcolor="#000000"> <div bgcolor="blue"> 文本内容 </div> <p bgcolor="yellow"> 段落内容 </p></code>
Notes
Since bgcolor is a deprecated property, it is recommended to use CSS The background-color property to set the background color. The syntax of CSS is more flexible and supports a richer range of color values and effects.The above is the detailed content of How to use bgcolor in html. For more information, please follow other related articles on the PHP Chinese website!