views:

74

answers:

6

I always forget what colors I'm dealing with in CSS when I see it hex value. I would like to use the name instead (e.g color: lightgreen). Is it supported by all browsers? (or only the basic 16 colors)?

A: 

All colors in rgb.txt are supported by the big browsers, but some may have slightly different definitions. Use the hex code to be safe.

Ignacio Vazquez-Abrams
A: 

I don't know whether this is possible with CSS. Can't you define the color names as constants in CSS?

Chathuranga Chandrasekara
by constants i think you mean classes
SpliFF
+2  A: 

I'll prefer the hex value since it is supported by all browsers and I can specify wide range of colors than the named colors.

Veera
+1  A: 

CSS uses 17 standard colors. These are all safe to use. There are also system colors whose values is system and browser dependent but might be useful for integrating into system defaults but this is deprecated by CSS3 Color (for whatever that is worth).

cletus
A: 

A detailed reading on this from wikipedia

Web colors

rahul
A: 

Use classes then

<style>.lightorange {color: #FE7A15 !important}</style>

<div class="lightorange info"></div>

This has the benefit you can refine your colors just by updating your CSS. Be aware though it isn't a great idea to name a class after how it appears, since you may want to change all your orange text to red and you'll end up with the class .lightorange {color:red} which is just odd.

SpliFF