Luciano Battagliero

The `border` Confusion

Note: I wrote this many years ago, so my views might have changed, or some content might be outdated.

Occasionally, confusion around border: 0 vs border: none comes up in code reviews.

Let’s try to clarify this a bit.

The border property is a shorthand, letting us 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;

So, 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, both values achieve the same result.

If the goal is to remove a border, I find border: 0 more explicit. Ultimately, as long as we’re consistent, either works just fine.

Scroll buffer added for your convenience.