The CSS Text (text) property can define the appearance of the text, such as the color of the text, aligned text, decorative text, text indentation, line spacing etc.
The most used It is the text color, and the color attribute is used to define the color of the text. The syntax is as follows:
div { span>
color:red;
}
Expression of color Has:
Predefined colors Value: red, green, pink, etc.
hexadecimal : #FF0000, #FF6600, #29D794, etc.
RGB code: rgb (255,0,0) or rgb(100%,0%,0%), etc.
Look at the effect:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/4cde2b43-56d7-4327-8b48-1fc821a4371a.jpg)
The corresponding code is :
<!< /span>DOCTYPE html>
< span>html lang="en">
< span>head>
< span>meta charset="UTF-8">
< span>meta http-equiv="X-UA-Compatible" content="IE= edge">
< span>meta name="viewport" content="width=device-width, initial- scale=1.0">
< span>title>Document</title>
< span>style>
div {
color: blue;
}
</< /span>style>
</< /span>head>
< span>body>
< span>div> People's Insurance said there are 7 car washes, 5 or 3 road rescues etc. </div>
</< /span>body>
</< /span>html>
All divs correspond to All are blue.
Use the second Method, expressed in hexadecimal color, first look at the effect:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/cb28d3cc-3b5e-4c30-9a9b-975f6fc048d6.jpg)
The corresponding code is:
<!< /span>DOCTYPE html>
< span>html lang="en">
< span>head>
< span>meta charset="UTF-8">
< span>meta http-equiv="X-UA-Compatible" content="IE= edge">
< span>meta name="viewport" content="width=device-width, initial- scale=1.0">
< span>title>Document</title>
< span>style>
/* div {
color: blue;
} */< /span>
div {
color: #FF0000;
}
</< /span>style>
</< /span>head>
< span>body>
< span>div> People's Insurance said there are 7 car washes, 5 or 3 road rescues etc. </div>
</< /span>body>
</< /span>html>
use the third at the end One way to see the effect:
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/df01c536-cd11-468d-8451-961883908dcf.jpg)
The corresponding code is :
<!< /span>DOCTYPE html>
< span>html lang="en">
< span>head>
< span>meta charset="UTF-8">
< span>meta http-equiv="X-UA-Compatible" content="IE= edge">
< span>meta name="viewport" content="width=device-width, initial- scale=1.0">
< span>title>Document</title>
< span>style>
/* div {
color: blue;
} */< /span>
/* div {
color: #FF0000 ;
} */< /span>
div {
color: rgb(255, 193, 100);
}
</< /span>style>
</< /span>head>
< span>body>
< span>div> People's Insurance said there are 7 car washes, 5 or 3 road rescues etc. </div>
</< /span>body>
</< /span>html>
rgb turned out to be red , green, blue, and I only found out today.
Today is the first Here it is, take a break at noon~
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Test%20and%20development%20full%20stackHTML%2012%20css%20font%20color%20attribute.html
评论列表(196条)
测试