Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"0" vs "none" as css attribute value

Tags:

css

I usually put 0 as value when i want to remove something in css. For example:

border: 0;
background: 0;

Is there any difference between 0 and none?

like image 798
Johan Avatar asked Jun 11 '12 10:06

Johan


1 Answers

When used with composite styles like border and background, the values will correspond to different properties.

border: 0 will set border-width: 0 while border: none will set border-style: none.

background: 0 will set background-position: 0 while background: none will set background-image: none.

So, there is a difference. In the case of the border, the difference doesn't make any visual difference as both remove the border, but for the background it can make a difference if you also set any other background properties.

like image 121
Guffa Avatar answered Sep 18 '22 01:09

Guffa