CSS Color

Advertisements

Prev Tutorial Next Tutorial

CSS Color

CSS uses Hexadecimal or Numerical values to specify a color. These are used to set the color of the background or foreground of an Html element.

Colors in CSS can be specified in various formats. Following table tells you all possible formats:

FormatSyntaxExample
Hex Code#RRGGBBp {color:#FF0000;}
Short Hex Code#RGBp {color:#6A7;}
RGB %rgb(rrr%,ggg%,bbb%)p{color:rgb(50%,50%,50%);}
RGB Absolutergb(rrr,ggg,bbb)p {color:rgb(0,0,255);}
keywordaqua, black, etc.p {color:teal;}

These formats are explained in more detail in the following sections:

CSS Colors - Hex Codes

  • A hexadecimal is a 6 digit representation of a color.
  • First two digits(RR) represent a red value.
  • Next two digits(GG) represent a green value.
  • Last two digits(BB) represent a blue value.
  • A hexadecimal value can be taken from any graphics software like Adobe Photoshop, Jasc Paintshop Pro or even using Advanced Paint Brush.
  • Each hexadecimal code will be preceded by a hash sign #.
  • Examples to use Hexadecimal notation. #66AA77, #4488DD

Syntax

background: #FFF000;

CSS Colors - Short Hex Codes

  • This is a shorter form of the six-digit notation. In this format, each digit is replicated to arrive at an equivalent six-digit value; For example: #6A7 becomes #66AA77.
  • A hexadecimal value can be taken from any graphics software like Adobe Photoshop, Jasc Paintshop Pro or even using Advanced Paint Brush.
  • Each hexadecimal code will be preceded by a pound or hash sign #.
  • Examples to use Hexadecimal notation. #6A7, #48D

Syntax

background: #FFF;

CSS Colors - RGB Values

This color value is specified using the rgb( ) property. This property takes three values, one each for red, green, and blue. The value can be an integer between 0 and 255 or a percentage.

Note: All the browsers does not support rgb() property of color so it is recommended not to use it.

Syntax

background:rgb(142,54,76);

Prev Tutorial Next Tutorial

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Google Advertisements


Buy Websites 9999595223

Buy Fresh and Payment Receive Media.net Account with Website. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements