Home >Web Front-end >CSS Tutorial >How to adjust font color in css

How to adjust font color in css

王林
王林Original
2021-03-04 15:27:493699browse

The method to adjust the font color in css is: you can use the color attribute to set the font color, such as [color: #92a8d1;] or [color:rgb(255,0,51)].

How to adjust font color in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

It is very simple to set the color of the font. CSS provides us with the color attribute, using which we can adjust the color of the font at will.

Attribute introduction:

The Color property specifies the color of the text.

Attribute value:

  • The name of the color The name of the color, such as red, blue, brown, lightseagreen, etc., is not case sensitive

  • Hexadecimal Hexadecimal symbols #RRGGBB and #RGB (such as #ff0000)

  • ##RGB, red-green-blue (red -green-blue (RGB)) specifies that the color value is the color of the rgb code, the function format is rgb(R,G,B), and the value can be an integer or percentage from 0-255.

Example 1:

The color is a hexadecimal value

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php.cn</title> 
<style>
body {color: #92a8d1;}
</style>
</head>
<body>

<h1>这是标题</h1>

<p>段落文本的颜色为 16 进制值。</p>

</body>
</html>

Running result:


How to adjust font color in css

(Learning video sharing:

css video tutorial)

Example 2:


Color value is RGB:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php.cn</title> 
<style>
body {color: rgb(255,0,51);}
</style>
</head>
<body>

<h1>这是标题</h1>

<p>段落文本的颜色为 16 进制值。</p>

</body>
</html>

Running results:


How to adjust font color in css

Related recommendations:

CSS tutorial

The above is the detailed content of How to adjust font color in 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