search
HomeWeb Front-endHTML TutorialHow 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:

I am a red font

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

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

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 most complete HTML5 tag


How to set the scroll bar for DIV



How to type multiple space characters in html?


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!

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
HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool