(Cascading Style Sheets) CSS 2.1 Reference
Color Values
Keywords for the Pre-Defined Colors |
Keyword Pre-Defined Colors |
RGB 6-Digit Hexadecimal |
RGB Integer Functional Notation |
aqua |
#00ffff |
rgb(0,255,255) |
black |
#000000 |
rgb(0,0,0) |
blue |
#0000ff |
rgb(0,0,255) |
fuchsia |
#ff00ff |
rgb(255,0,255) |
gray |
#808080 |
rgb(128,128,128) |
green |
#008000 |
rgb(0,128,0) |
lime |
#00ff00 |
rgb(0,255,0) |
maroon |
#800000 |
rgb(128,0,0) |
navy |
#000080 |
rgb(0,0,128) |
olive |
#808000 |
rgb(128,128,0) |
orange |
#ffa500 |
rgb(255,165,0) |
purple |
#800080 |
rgb(128,0,128) |
red |
#ff0000 |
rgb(255,0,0) |
silver |
#c0c0c0 |
rgb(192,192,192) |
teal |
#008080 |
rgb(0,128,128) |
white |
#ffffff |
rgb(255,255,255) |
yellow |
#ffff00 |
rgb(255,255,0) |
A color can be specified using a keyword or a RGB (Red Green Blue) specification.
-
Keyword Pre-Defined Colors:
Pre-defined colors that can be used by specifying one of the following keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, or yellow.
-
Keyword System Colors:
System colors depend on the graphic environment of the operating system and can be used by specifying one of the following keywords. The system color keywords are case-insensitive: ActiveBorder, ActiveCaption, AppWorkspace, Background, ButtonFace, ButtonHighlight, ButtonShadow, ButtonText, CaptionText, GrayText, Highlight, HighlightText, InactiveBorder, InactiveCaption, InactiveCaptionText, InfoBackground, InfoText, Menu, MenuText, Scrollbar, ThreeDDarkShadow, ThreeDFace, ThreeDHighlight, ThreeDLightShadow, ThreeDShadow, Window, WindowFrame, or WindowText.
Note: These system colors are deprecated in the CSS3 Color Module.
-
RGB 3-Digit Hexadecimal:
Color can be specified by following a '#' with a 3-digit hexadecimal value. The first digit represents the color red, the second digit the color green, and the third digit the color blue. Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. To specify the color red, for example, set the first digit (red) to its maximum value and the other 2 digits (green and blue) to their minimum values as follows: #f00.
-
RGB 6-Digit Hexadecimal:
Color can be specified by following a '#' with a 6-digit hexadecimal value. The first 2 digits represents the color red, the second 2 digits the color green, and the third 2 digits the color blue. Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. The smallest 2 digit hexadecimal number possible is 00 and the largest is ff. To specify the color red, for example, set the first 2 digits (red) to their maximum value and the other 4 digits (green and blue) to their minimum values as follows: #ff0000.
-
RGB Integer Functional Notation:
Color can be specified by following 'rgb' with 3 comma separated integers enclosed in parentheses. The syntax looks like rgb(integer,integer,integer). The first integer represents the color red, the second integer the color green, and the third integer the color blue. Each integer can range in value from 0 to 255. To specify the color red, for example, set the first integer (red) to its maximum value and the other 2 integers (green and blue) to their minimum values as follows: rgb(255,0,0).
-
RGB Percentage Functional Notation:
Color can be specified by following 'rgb' with 3 comma separated percentage values enclosed in parentheses. The syntax looks like rgb(number%,number%,number%). The first percentage value represents the color red, the second percentage value the color green, and the third percentage value the color blue. Each percentage can range in value from 0% to 100%. To specify the color red, for example, set the first percentage value (red) to its maximum value and the other 2 percentage values (green and blue) to their minimum values as follows: rgb(100%,0%,0%).