Luciano Battagliero

§The `border` Confusion

Published on

Both border: 0 and border: none remove a border. They’re often treated as interchangeable, but they target different sub-properties.

The border property is a shorthand(opens in new tab) that allows us to set multiple values at once. For example, these declarations are equivalent:

/* Shorthand */
border: 1px solid #000;

/* Longhand */
border-width: 1px;
border-style: solid;
border-color: #000;

border: 0 is equivalent to border-width: 0, while border: none is equivalent to border-style: none. Since a border without width or style can’t be rendered, the result is the same.


If the goal is to remove a border, border: 0 is more explicit about intent. But either works; just stay consistent.

Filed under #technical

Subscribe to the RSS feed