Font text"; 2. Use the style attribute in the label element containing the font text and add "color: Color value;" style; 3. Use id or class to introduce external CSS font color style to set the html font color, the syntax is "id or class selector {color: color value;}"."/> Font text"; 2. Use the style attribute in the label element containing the font text and add "color: Color value;" style; 3. Use id or class to introduce external CSS font color style to set the html font color, the syntax is "id or class selector {color: color value;}".">

Home  >  Article  >  Web Front-end  >  How to set font color in html

How to set font color in html

青灯夜游
青灯夜游Original
2023-03-08 10:04:2622419browse

htmlHow to set font color: 1. Use the font tag, the syntax "font text"; 2. In the label element containing the font text Use the style attribute to add the "color: color value;" style; 3. Use id or class to introduce external CSS font color style to set the html font color, the syntax is "id or class selector {color: color value;}".

How to set font color in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Method 1: Use the font tag

to specify the font, font size, and font color of the text.

Syntax for setting font color:

<font color="颜色值">字体文本</font>

Example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<div>我是默认黑色字体</div>
		<div><font color="red">我是红色字体</font></div>
	</body>
</html>

Rendering:

How to set font color in html

##Method 2: Use the style attribute to add the "color: color value;" style

The style attribute specifies the inline style of the element.

The style attribute will override any global style settings, such as those specified in the

The above is the detailed content of How to set 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
Previous article:What is html divNext article:What is html div