Home  >  Article  >  Web Front-end  >  How to set text color in css

How to set text color in css

藏色散人
藏色散人Original
2021-04-29 09:25:423648browse

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.

How to set text color in css

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!

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
Previous article:How to add css styleNext article:How to add css style