CSS Color

SQL     Data Warehousing     CSS     PHP     HTML     Database Normalization

CSS Tutorial  >  Color

The color property allows webmasters to define the color of an element in a CSS stylesheet.

This property takes values in 3 forms:

  • Hexadecimal code
  • RGB
  • Color name

    The general syntax for the color property is as follows:

    Hexadecimal code:


    where X is a hexadecimal code.


    {color:rgb(X,Y,Z); }   where X, Y, and Z are numbers between 0 and 255
    {color:rgb(X%,Y%,Z%); }   where X, Y, and Z are numbers between 0 and 100.

    Color name:


    Hexadecimal code is a 6-character (or 3-character when the first two, the middle two, and the last two codes of the 6-character presentation are all the same. For example, #FFF and #FFFFFF both mean white) code specifying the color. This hexadecimal color chart shows how hexadecimal codes correspond to the colors they render.

    Below are examples showing how each form described above can be used to specify a color.

    CSS DeclarationOutput

    p {color:#FF0000;}

    FF0000 is red.

    p {color:rgb(255,0,255);}

    rgb(255,0,255) is pink.

    p {color:green;}

    This is green.

    Next: CSS Font

    Copyright © 2015   1keydata.com   All Rights Reserved   Privacy Policy   About   Contact