Home >Web Front-end >CSS Tutorial >How to set font color using css

How to set font color using css

青灯夜游
青灯夜游Original
2021-05-13 14:59:1349180browse

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.

How to set font color using css

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:

How to set font color using css

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:

How to set font color using css

(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!

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