Home  >  Article  >  Web Front-end  >  Detailed introduction to css color

Detailed introduction to css color

零下一度
零下一度Original
2017-06-16 15:42:503024browse

color: Specify color. See Color Units and Appendix: Color Table
Description:
Retrieve or set the text color of the object. No default value.
Note that specifying color with a color name is not accepted by some browsers.
The corresponding script feature is color. Please see other books I have written.
Example:

div {color: #345456; } 
div { color: rgb(100,14,200); } 
div {color: menu; } 
div {color: red; }

color is the color of the font,

background-color is the color of the background

color attribute in css Can I inherit it~! ! ?

The color attribute in css can be inherited. First, you need to understand the concept of the parent element, just like a div wrapping p or some other tags. These colors can be inherited. Yes, but some tags cannot be inherited, such as the a tag, you need to change it manually. For details, you can see the code:

<html>
<head>
<style>
#round{
color:#f00;   //红色
}
a{
color:#0f0;  //绿色   需要单独设置
}
</style>
</head>
<body>
<div id="round">
<p>测试文字1</p>
<p>测试文字2</p>
<a href=&#39;&#39;>测试</a>
</div>
</body>
</html>

How to set the font color in CSS

Detailed introduction to css color

Implementation principle:

Set the font color through the color of the paragraph

tag.

Code meaning:

Define the color as red.

Original code:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gbk" />
<title></title>
</head>
<body>
<p style="color: red;">我要把字体设置为红色</p>
</body>
</html>

The above is the detailed content of Detailed introduction to css color. 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