CSS Colors


Colors are displayed combining RED, GREEN, and BLUE light.

Colors in CSS are most often specified by:
  • a valid color name - like "red"
  • an RGB value - like "rgb(255, 0, 0)"
  • a HEX value - like "#ff0000"

Color Names

Colors set by using color names:

Example

ColorName
 Red
 Green
 Blue
 Orange
 Yellow
 Cyan
 Black
Note: Color names are case-insensitive: "Red" is the same as "red" or "RED".
HTML and CSS supports 140 standard color names.

RGB (Red, Green, Blue)

RGB color values can be specified using this formula: rgb(red, green, blue).
Each parameter (red, green, blue) defines the intensity of the color between 0 and 255.
For example, rgb(255,0,0) is displayed as red, because red is set to its highest value (255) and the others are set to 0. Experiment by mixing the RGB values below:
RedGreenBlue
255120
rgb(255, 12, 0)

Example

ColorRGB
 rgb(255,0,0)
 rgb(0,255,0)
 rgb(0,0,255)
 rgb(255,165,0)
 rgb(255,255,0)
 rgb(0,255,255)

No comments:

Post a Comment