CSS Color


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:

    {color:#XXXXXX;}

    where X is a hexadecimal code.

    RGB:

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

    Color name:

    {color:[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

    Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.






    Copyright 1keydata.com 2007, 2008, All Rights Reserved.   Privacy Policy  



  • CSS Tutorial
    CSS Syntax
    Apply CSS
    CSS Media Types
    CSS Cascade
    CSS Inheritance
    CSS Class ID
    CSS Div Span
    CSS Length Units

    CSS Box Model
    CSS Margin
    CSS Border
    CSS Padding
    CSS Background
    CSS Color
    CSS Font
    CSS Link
    CSS List
    CSS Table
    CSS Position
    CSS Text
    CSS Float
    CSS Clear
    CSS Cursor

    CSS Codes

    Resources

    German