CSS tutorial: Several representation of webpage colors

Source: Internet
Author: User

Css can process 16,777,216 colors and use names, rgb values, or hexadecimal code.
Red
Equivalent
Rgb (255, 0, 0)
Rgb (100%, 0%, 0%)
# Ff0000
# F00



There are 17 pre-determined 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.

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

We usually use the hexadecimal notation 0-9, but hexadecimal uses the hexadecimal notation 0 to f.

In hexadecimal notation, three or six digits are preceded by # characters, and the three are six compression formats. For example, # f00 is the compression of ff0000 and # c96 is # cc9966. Three digits are easy to understand, such as rgb. The first is red, the second is green, and the third is blue. But the six digits give more color control.

Color and background-color

The color can use color and background-color, which are "color" not "color" in American English ".

Blue background, yellow text:

H1 {
Color: yellow;
Background-color: blue;
}


These colors may be rough and you can use another color:

Body {
Font-size: 0.8em;
Color: navy;
}
H1 {
Color: # ffc;
Background-color: #009;
}

You can see that h1 has become yellow and blue. 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.