user2507818
user2507818

Reputation: 3037

css: is there any difference between hexadecimal color value and hexadecimal color value in shorthand?

css:

h1 {color:#000;}

html:

<h1>This is heading 1</h1>

Question:

Is there any difference between color:#000;(hexadecimal color value in shorthand) and color:#000000(hexadecimal color value)?

Upvotes: 3

Views: 1799

Answers (4)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85575

There is no difference in both color but color: #000000; is more preferable to use for eg you can change with more colors that is #010101; but you can't do this in #000;

With first #000 it can select 8-bit color but with second #000000 it can select 16-bit color

Upvotes: 1

James Allardice
James Allardice

Reputation: 166011

There is no difference at all. As per the CSS Color Module spec:

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. This ensures that white (#ffffff) can be specified with the short notation (#fff)...

Upvotes: 7

anaconda
anaconda

Reputation: 1092

No difference.

Any color like #XXYYZZ can be written as #XYZ

Upvotes: 1

tea2code
tea2code

Reputation: 1007

No there is no difference. They describe exactly the same. Only shorter and easier to read.

Upvotes: 1

Related Questions