Background-color: white - ok or use hexidecimal?

Possible duplicate:
Are there any flaws in using color names instead of color codes in CSS?

When specifying background colors and background colors in CSS, is it possible to use white words rather than a hexadecimal value? This seems like normal to me, but are there any issues with other devices or older browsers?

thank

+3
source share
4 answers

This is taken from the W3C specification. And this clearly suggests that names are depreciating. Its only preserved for obsolete reasons.

Techniques:

Use numbers, not names, for colors.
Example.

Use numbers, not names, for colors:

   H1 {color: #808000}
   H1 {color: rgb(50%,50%,0%)}
Deprecated example.

 H1 {color: red}
Use these CSS properties to specify colors:

'color', for foreground text color.
'background-color', for background colors.
'border-color', 'outline-color' for border colors.
For link colors, refer to the :link, :visited, and :active pseudo-classes.
+1
source

There are several colors that are defined in the CSS specification , so any CSS compatible browser will display your color correctly.

0
source

Personally, I like to use the color name whenever possible. Despite the fact that the hexadecimal value is pretty obvious that its white / black, it is much easier for me to choose a color when it's white. That being said, I don’t think that there are names for all colors, so sometimes we need hexials.

But in the end, both are acceptable.

0
source

All Articles