Colors are the quintessential part of styling in general. Web page designers too need to be very specific about their color choices in order to provide the right feel to the user. Thus, web-page styling language CSS, also has colors as one of its important features.
Almost all the popular browsers in their latest versions, allow 120+ colors. CSS has different ways of controlling the coloring aspect of the web-pages. Let’s take a look at each, one by one.
Color Names
The easiest way is to specify the color name that you wish to use and CSS has the color names already associated with the respective colors at your service. Currently, CSS can recognise up to 140 different color names.
RGB Values
The RGB color scheme is one of the most used styling techniques in programming. Each color is defined by the different intensities of the base colors (Red, Green, Blue) the minimum allowed value for each of the three colors is 0 and maximum is 255. So, if the color code is (0,255,0) we know that the color is Green.
Hexadecimal Values
It is somewhat similar to RGB but here, instead of three different numbers, we use a single Hexadecimal code for each color. The general hexadecimal code for any colors is #RRGGBB. Therefore the RGB intensity is defined in a single code with values ranging from 00 to FF for each RR, GG ad BB. The hexadecimal codes can be used in both Upper and Lower cases.
The CSS Colors can be used for simple HTML elements like the texts, backgrounds, table cells etc. As mentioned earlier, CSS can recognise 140 color name which covers majorly all the requirements. However, the Hexadecimal and RGB codes enabled CSS to used more than 16.5 million color shades which help it to create more complex styling constructs like animations, shadows etc.