What is the right way to remove the edge with CSS?

Asked

Viewed 8,001 times

4

To remove edges in CSS I usually use one of the two values:

.exemplo{
    border:0;
    /* ou */
    border:none;
}

The funny thing is that they both work, and it happens with other properties like outline, but which of the two properties would be the correct to be used in this case? Or rather, there is a "correct" (semantically speaking) or it makes no difference?

3 answers

5


See section 8.5.3 of this page of the W3C (regulatory body) available at this link:

http://www.w3.org/TR/CSS2/box.html#propdef-border

According to the same none is the property that defines that the element will have no edge and will be computed with 0.

Both are correct, but if your intention is to have no edge use 'None' that better demonstrates your code intentions (semantics).

2

Either one of you is worth.

According to the specifications, you use a or the other.

Value:      [ <border-width> || <border-style> || <'border-top-color'> ] | inherit

Size: 0 or Style: none, both are considered correct and can be used alone

Unless you’re worried about the size of the css and therefore the performance, then it’s worth more (by little, very little, almost nothing) use the 0, although the difference is not noticed so soon.

2

Both are correct, if you set 0 or None on the same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.