Usage analysis of RGB colors in CSS

Source: Internet
Author: User
This article mainly introduces the use of RGB color CSS in the detailed, is the basic knowledge of CSS primer learning, the need for friends can refer to the following

RGB Color Model Interpretation

The RGB color model is a way of describing how many red, green, and blue primaries are in a color, like mixing watercolor or oil paints to get some real color that we want.

Imagine if you're going to be given a pure blue, you can't put red and green in this color in order to achieve this. So we set the red and green to 0% and the green to 100%:

RGB (0%, 0%, 100%)

Results:

But what if what you want is not blue but magenta? We can get magenta by mixing 100% red and 100% Blue:

RGB (100%, 0%, 100%)

Results:

From the basis of the color theory, we know that no color is black. So in order to get black we can achieve by setting the red, green, and blue Primary colors to 0%:

RGB (0%, 0%, 0%)

Results:
How to determine the value of an RGB color

We can use Photoshop's color picker feature to get the values of the red, green, and blue primaries of a particular color, but there are also free online tools such as the Color slider and the RGB color Calculator.

Explanation of RGB colors on the W3school:

RGB Color

RGB color values are supported for all browsers.

RGB color values are defined as: rgb (red, green, blue). Each parameter (red, green, and blue) defines the intensity of the color, either an integer between 0 and 255, or a percentage value (from 0% to 100%).

For example, the RGB (0,0,255) value is shown in blue because the blue parameter is set to the highest value (255) and the other is set to 0.

Similarly, the following values define the same color: rgb (0,0,255) and RGB (0%,0%,100%).
Instance

P   {   background-color:rgb (255,0,0);   }

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Related recommendations:

Using CSS to achieve shadow effects

Several color gradient patterns commonly used in CSS3

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.