Home > Article > Web Front-end > How to modify the font color in html
Many friends are very troubled, how to change the font color in HTML? How to set the font color? So today we will introduce to you how to modify the font color in HTML and how to obtain the font color.
First we need to know the html font color setting
In HTML we use the font tag to set the color of the font content.
1. Font syntax:
c0025c2938efc05b97bd9beea08ca0c4I am a red fonte6e38b3c62e8df885fe2e3986461aa63
First of all, font is a pair of regular tags , put the font text content into the label, set the color color + the corresponding color value in the font label to set the font color in the font label object.
htmlFull code of font color example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>font字体颜色在线实例 DIVCSS5</title> </head> <body> <font color="#FF0000">我是红色字体</font> <table width="300" border="1"> <tr> <td><font color="#0000FF">你好</font></td> <td>DIVCSS5</td> </tr> </table> </body> </html>
If you want to change the font color with this method, you only need to change the color value.
html div css fontColor setting
So to summarize, if you want to set the font color through css style in html, how to do it There are two types, one is in-label CSS and the other is external CSS.
Using external CSS, you can put the CSS code separately into the CSS file and use html link to introduce CSS (html introduces css), or you can use the c9ccee2e6ea535a969eb3f532ad9fe89 tag in html to create CSS. You can also use the style attribute within the html tag to set the css color.
Here are two methods to implement HTML font color settings, one using css in the tag, and the other using the style tag to implement font color setting.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>css实现字体颜色 在线演示 DIVCSS5</title> <style> .divcss5{color:#F00} </style> <!-- html注释说明:使用style标签设置字体颜色 --> </head> <body> <div class="divcss5">我字体是红色</div> <div style="color:#00F">我字体是蓝色</div> <!-- div标签内使用style属性设置字体颜色 --> </body> </html>
Use the c9ccee2e6ea535a969eb3f532ad9fe89 tag and the style attribute in the DIV tag to set the font color in html.
htmlHyperlinkA font color setting
There are two situations for setting the color of the anchor text font in html. One is to set the font in all a hyperlinks in html. Set a unified font color, and the other is to set a separate color for the anchor text hyperlink font within the specified object.
Through examples, I will introduce to you the unified setting and individual setting of the font color of hyperlink anchor text in HTML.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>html超链接字体颜色设置 在线演示 DIVCSS5</title> <style> a{ color:#00F} a:hover{ color:#F00}/* 鼠标经过悬停字体颜色 */ /* css 注释说明:以上代码为设置html中超链接统一字体颜色 */ .div a{ color:#090} .div a:hover{ color:#090} /* css注释说明:以上代码为设置html中.div对象内超链接字体颜色 */ </style> </head> <body> <p>测试内容我是统一设置的颜色蓝色<a href="http://www.divcss5.com">DIVCSS5</a></p> <div class="div">我在div对象内,超链接颜色为<a href="#">我是超链接绿色</a></div> </body> </html>
The blue font color of the hyperlink is set uniformly in HTML, while the green font color is the individually set hyperlink font color.
How to obtain the accurate font color required for HTML
To obtain accurate color values, generally use Photoshop (ps) software. The following DIVCSS5 teaches you how to use PS to obtain the color value of a certain font, and flexibly apply it to obtain the color value of a certain background, picture or border by obtaining the font value.
If we want to get the specific blue color value of the above picture "CSS"
If we want to get the specific blue color value of the above picture "CSS"
1. Open PS This picture
psOpen this picture to get the color
psOpen this picture
2. Use the "Select Foreground Color" or "Select Background" of the PS tool "Color" tool
Here we click the "Foreground Color" tool in the red box
Here we click the "Foreground Color" tool in the red box
3. "Select Foreground Color" pops up "Tab
After the second step, the "Select Foreground Color" tab will pop up. At the same time, the mouse pointer will turn into a straw-like icon "Color Picker". At this time, click on the color you need to get. It is worth mentioning that if the picture is small and difficult to click accurately, you can enlarge the picture by using "ctrl+++" to continuously enlarge the picture.
Get the accurate color value "0000FF"
Get the accurate color value "0000FF"
4. Set the color value obtained using
color:# 0000FF
Tips: When using color values, generally go directly to PS to copy the color values to avoid manual input errors. At the same time, don’t forget to add the “#” sign before the color value.
Related reading:
The above is the detailed content of How to modify the font color in html. For more information, please follow other related articles on the PHP Chinese website!