CSS COLORS
CSS COLORS
CSS uses color values to specify a color for an element (background or text) or document.They can also be used to affect the color of borders and other decorative effects. The color vaule can be put in different forms like
Hex Codes
A hexadecimal is a 6 digit representation of a color. The first two digits(RR) represent a red value, the next two are a green value(GG), and the last are the blue value(BB). 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 '#'.
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 '#'.
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 nsupport rgb() property of color so it is recommended not to use it.
background-color:rgb(255, 99, 71);
background-color:#ff6347;
background-color:hsl(9, 100%, 64%);
background-color:rgba(255, 99, 71, 0.5);
background-color:hsla(9, 100%, 64%, 0.5);
Color Names
In HTML, a color can be specified by using a color name, for example: Tomato,Orange,DodgerBlue etc. As started above color can be added to either an element or a document, Here is a few example:
Background Color
You can set the background color for HTML elements: example
background-color:blue;
Text Color
You can set the color of text:
color:grey;
Border Color
CSS can be used to set the color of borders:
border:2px solid Tomato;
border:2px solid DodgerBlue;
border:2px solid Violet;