CSS built-in colors (color) value detailed

Source: Internet
Author: User

CSS can handle 16,777,216 colors, using first name, RGB value, or hexadecimal code.

red红色
等同于
rgb(255,0,0)
rgb(100%,0%,0%)
#ff0000
#f00

There are 17 predefined colors, which 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.

RGB three values are from 0 to 255,0 is the lowest, 255 is the highest, these values can also be percentages.

We usually use 10 in 0-9, but hexadecimal uses 16, or 0 to F.

Hexadecimal three or six digit lengths are preceded with a # character, and three lengths are six compression forms, such as #f00 is ff0000 compression, #c96是 #cc9966. Three digits are well understood, like RGB, the first is red, the second is green, and the third is blue. But the six-digit number gives more color control.

Color and Background-color

Colors can be used with color and Background-color, is American English "color" is not "colour".

Blue background, yellow text:

h1 {
color: yellow;
background-color: blue;
}

These colors may be coarse and you can use additional chroma:

body {
font-size: 0.8em;
color: navy;
}
h1 {
color: #ffc;
background-color: #009;
}

You can see that H1 has turned yellow and blue, and color and background-color can be used in most HTML elements, including the body.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.