Should one use "black" or "#000"?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Should one use "black" or "#000"?

Post by Ambush Commander »

I know this sounds a bit absurd, but I'd be really interested if there was a real answer. In CSS color attributes like color: or background-color:, is it preferable to use a hexadecimal value (#000) or a keyword (black)?

On one hand, one is more readable. On the other hand, the other is far more specific, won't do anything weird, and, most of the time, takes up less bytes.

Or is this whole question irrelevant?
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

i prefer just using the color name lol
its much easier
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: Should one use "black" or "#000"?

Post by Roja »

Ambush Commander wrote:I know this sounds a bit absurd, but I'd be really interested if there was a real answer. In CSS color attributes like color: or background-color:, is it preferable to use a hexadecimal value (#000) or a keyword (black)?
Of course there is an answer. These are the type of people that write standards that include how many PIXELS specific FONTS should shift when tables meet layers meeting div's.. you get the idea. They dictate everything under the sun. :)
WebStandard wrote: There are sixteen (16) legal color names for use in HTML 4.x and XHTML. Any other color name is a browser-specific name and cannot be used in conforming HTML 4.x and XHTML documents.
Now, with that out of the way, yes, short hex code colors are also shorter (less bandwidth), better supported (all the way back to NS4), AND make it easier to avoid using non-websafe colors (most of the 3-digit codes are websafe).
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

As using hexcodes is much more flexible, and I want to keep the structure of everything, I just use hexadecimal codes. Imo, they're easier to examine, as you see the different aspects of colors and not just a name which doesn't say anything :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I don't even see hex, I see the color :wink:

(yes, like The Matrix)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Well then, Hexadecimal it is. It's what I used in the past anyway.
Post Reply