I've just noticed myself using both border: none
and border: 0
to reset a border in the cascade.
Is there a One True Way™ to reset a border that has already been set?
I've just noticed myself using both border: none
and border: 0
to reset a border in the cascade.
Is there a One True Way™ to reset a border that has already been set?
Sounds pretty subjective if you ask me :) Personally I use border: none
as it semantically makes more sense. I use the number 0
if I'm only setting border-width
.
EDIT: as you should probably be aware, border
is a shorthand property. I found out that both of those values do not pertain to the shorthand property itself but each belongs to one of the more 'fine-grained' CSS border properties.
none
is a value for border-style
0
is a value for border-width
Either way, you're really just defining no border.
Completely up to you, some say one way, some say the other. The border: none
is the 'technical' way to do it because 'none' is a listed allowed value for border, but border: 0
is just basically a short-hand version to save a few extra characters. I don't even know which one I use, it doesn't really bother me either way.
Edit: Here's another good conversation on a similar topic (0 vs 0em)...
http://stackoverflow.com/questions/935107/css-difference-between-0-and-0em
technically, it should be border: 0 <-- if you are using the short hand,
OR border-style:none; <-- I prefer this, but if a few char matters...
The shorthand is border: [width] [style] [color];
http://www.w3schools.com/css/css_border.asp (or the formal specification: http://www.w3.org/TR/CSS2/box.html#border-properties)
Note: As pointed out by below comment. border: 0px;
is redundant but border: 1px;
is not. Units (em, ex, px, etc) are not optional when value > 0.