CSS Color

0

- Advertisement -

In HTML CSS uses color values to specify a color. You can specify the Colors in various formats like RGB, HEX, HSL, RGBA, and HSLA values.

The given following table will help you to understand the color format of CSS.

FromatSyntaxExample
Hex Code#800000p[color: #800000;}
Short Hex Code#RGBp{color:#6A7;}
RGB %rgb(rrr%,ggg %,bbb%)p{color:rgb(50%, 50%, 50%); }
Keywordred, black etc.p{color:green;}

Text color

If you want to change the color of text then set the color of the text.

Border Color

If you want to change the border color of text then set the color of the text.

CSS Colors- Hex Codes

In Hex codes there are 6 digits to represent the color. Each hexadecimal code will be used within the hash ‘#’ sign.

There are the following 6 digits values of Hex Code in detail.

  • The first two digits represents red value(RR).
  • The second two digits represent the green value(GG).
  • The third two digits represents blue value(BB).

The following table will help you to implement the Hexadecimal notation:

Color NameColor Hex
Black#000000
Red#FF0000
Green#00FF00
Blue#0000FF

Let us see an example of CSS color-hex codes:

CSS Colors- RGB Values

In CSS Color, RGB values are represented by rgb() property. It takes three values red, green, and blue. The value can be an integer between 0 and 225 or a percentage.

NOTE: There are various browsers not supported in rgb() property of color.

The following table will help you to implement Hexadecimal notation:

Color NameRGB Value
Blackrgb(0,0,0)
Redrgb(255,0,0)
Greenrgb(0,225,0)
Bluergb(0,0,225) etc.

Let us see an example of CSS color-RGB values:

- Advertisement -

Leave A Reply

Your email address will not be published.