Home > Web Front-end > CSS Tutorial > Instructions for using CSS color color_Basic tutorial

Instructions for using CSS color color_Basic tutorial

WBOY
Release: 2016-05-16 12:05:11
Original
2375 people have browsed it

red
Equivalent to
rgb(255,0,0)
Equal to
rgb(100%,0%,0%)
Equal to
#ff0000
Equivalent to
#f00
There are 17 predetermined colors, they are:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,
olive, orange, purple , red, silver, teal, white, and yellow.
transparent is also a correct value.

The three values ​​​​of rgb are from 0 to 255, 0 is the lowest level, 255 is the highest level, these values ​​​​can also be percentages.

We usually use base 10, that is, 0-9, but hexadecimal uses base 16, that is, 0 to f.

The length of three or six hexadecimal digits is preceded by the # character. Three lengths are the compressed form of six. For example, #f00 is the compression of ff0000, and #c96 is #cc9966. Three digits are easy to understand, like rgb, the first is red, the second is green, and the third is blue. But six digits gives more color control.

color and background-color

For color, you can use color and background-color. In American English, "color" is not "colour".
Blue background, yellow text:


h1 {
color: yellow;
background-color: blue;
}
These colors may be rough, You can use another color:


body {
font-size: 0.8em;
color: navy;
}
h1 {
color: #ffc;
background-color: #009;
}
You can see that h1 has turned yellow and blue.
Color and background-color can be used in most html elements, including body.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template