Three formats of CSS color values: name, RGB, and hexadecimal

Source: Internet
Author: User

CSS encoding is essential for color control. Not many of them are involved. But this is the basic knowledge. New friends need to know something, and the veterans can ignore it.

Theoretically, the number of colors that CSS can process is about 16,777,216. Enough. How can we express these colors in three forms:

 
1. Name: blue
2. RGB, for example, 255, 0, and 0
3. Hexadecimal format: # ff6600
If we want to set the red color, it can be in the following format:

 
Name: red
RGB: rgb (255, 0, 0)
RGB: rgb (100%, 0%, 0%)
Hexadecimal: # ff0000
Hexadecimal: # f00
For detailed development, you can refer to the following files:

As shown in the following figure:


CSS has 17 predefined colors, which are:
Aqua, black, blue, fuchsia, gray,
Green, lime, maroon, navy, olive,
Orange, purple, red, silver,
Teal, white, yellow.
(Note: transparent transparency 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.

In hexadecimal notation, three or six digits are preceded by # Characters, and the three are six compression formats. For example, # 00f is # 0000ff compression, and # c30 is # cc3300. Three digits are easy to understand, such as rgb. The first is red, the second is green, and the third is blue. However, more color control can be achieved by six digits.

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.