Home > Article > Web Front-end > How to set text color in css
How to set text color in css: 1. Use the color attribute in the DIV tag to set the text color style; 2. Use the color attribute in the CSS selector to set the text color style.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Two methods to set the object color style
1. Use the color color style in the DIV tag
<div style="color:#F00">www.php.cn</div>
2. Use the color color style in the CSS selector CSS code:
.divcss5{color:#00F} /* 设置对象divcss5内文字为蓝色 */
color attributeSpecifies 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.
To set the foreground color of an element, the easiest way is to use the color attribute.
For more detailed HTML/CSS knowledge, please visit the CSS Video Tutorial column!
The above is the detailed content of How to set text color in css. For more information, please follow other related articles on the PHP Chinese website!