How to set font color with css: 1. Use the "style="color:color value"" code directly in the tag where the text is located to set the font color; 2. Use id or class to introduce external or embedded CSS font color style to set the font color.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
1. Set the CSS font color style in the tag
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /></head> <body> <div>测试文本</div></body> <div style="color:red;">测试文本</div></body> </html>
Rendering:
2. External CSS sets the html text font color
Use id or class to introduce external or embedded CSS font color styles to set the html font color.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <style> .ex { color: pink; } </style> </head> <body> <div>测试文本</div> <div class="ex">测试文本</div> </body> </html>
Rendering:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to set font color using css. For more information, please follow other related articles on the PHP Chinese website!