Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#FFFFFF or "white" in CSS?

Tags:

css

Is there a difference between #FFF (#FFFFFF) and white in CSS? Is one better than the other?

like image 214
David Klein Avatar asked Jan 28 '11 05:01

David Klein


3 Answers

All are supported in the major browsers. It comes down to whichever unjustifiable, deep-seated prejudice you personally have for/against hexadecimal/the English language.

like image 104
sdleihssirhc Avatar answered Oct 25 '22 15:10

sdleihssirhc


They're all guaranteed to be the same. CSS 3 Color Module (a Proposed Recommendation) defines white as #ffffff.

It later says that values like #rgb are converted to #rrggbb:

The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00.

That means that #fff is equivalent to #ffffff (by doubling).

like image 35
Matthew Flaschen Avatar answered Oct 25 '22 15:10

Matthew Flaschen


there is no difference. I would imagine browsers take "white" and translate it to "#FFFFFF" in the background. its just a matter of personal coding style which you will use. I prefer using hash because its easier to read and recognise as a colour

like image 27
Darko Z Avatar answered Oct 25 '22 16:10

Darko Z