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

How to set text color in css

coldplay.xixi
Release: 2023-01-03 09:30:02
Original
14588 people have browsed it

How to set text color in css: 1. Use the color color style in the DIV tag, the code is [<div style="color:#F00">www.php.cn</div>] ;2. Use the color color style CSS code in the CSS selector.

How to set text color in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to set text color in css:

1. Use the color color style in the DIV tag

<div style="color:#F00">www.php.cn</div>
Copy after login

2. Use the color color style CSS code in the CSS selector:

.divcss5{color:#00F}
/* 设置对象divcss5内文字为蓝色 */
Copy after login
Copy after login

Extended reading: Here are instructions for setting this style using CSS comments, understand CSS comments

3. Complete example of DIV CSS color style:

Css code:

The code is as follows:

.divcss5{color:#00F}
/* 设置对象divcss5内文字为蓝色 */
Copy after login
Copy after login

HTML code:

The code is as follows:

<p>
标签内使用color css样式
<div style="color:#F00">www.php.cn 红色</div>
</p>
<p>外部样式表设置对象color颜色
<div class="divcss5">www.php.cn 蓝色</div>
</p>
Copy after login

Related learning recommendations: css tutorial

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!

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