Course Content
Introduction to CSS Part II
Introduction to CSS Part II
Сolor Formats 1/2
In CSS, colors can be represented in many ways. The most common ones are through the RGB techniques of both hex values and separate values of RGB in decimal.
RGB
RGB stands for Red, Green, Blue and is a color model used to represent colors on a screen. In this model, colors are created by combining different intensities of the three primary colors: red, green, and blue.
The RGB color value format is used to specify colors using this color model. It is written as rgb(red, green, blue)
, where each of the red
, green
, and blue
values can range from 0 to 255, representing the intensity of the corresponding primary color.
For example, the color white can be specified using the RGB color value rgb(255, 255, 255)
, as it has equal red, green, and blue intensities. On the other hand, the black color can be specified using the RGB color value rgb(0, 0, 0)
, as it is made up of zero red, green, and blue intensities.
Here is an example of how the rgb color value can be used in a CSS rule:
index
index
index
Hex
The hex color value format is another way to specify colors in CSS. It is a six-digit hexadecimal code representing the combination of red, green, and blue intensities. The first two digits represent the intensity of red, the middle two represent the intensity of green, and the last two represent the intensity of blue.
For example, the color white can be specified using the hex color value #ffffff
, and the color black can be specified using the hex color value #000000
.
Here is an example of how the hex color value can be used in a CSS rule:
index
index
index
Thanks for your feedback!