aprestmo
aprestmo

Reputation: 63

Disable border (border: 0 none)

I've always used the notation border: 0 none, presumably that means border-width: 0 and border-style: none.

Does anybody else use write it this way? Is it really necessary to declare both style and width for safe removal?

Upvotes: 3

Views: 7785

Answers (2)

Kevin Bowersox
Kevin Bowersox

Reputation: 94429

border:none; should achieve the same effect according to the spec.

The border property can be set with the following values:

<line-width> || <line-style> || <color>

When one of these values is omitted its value is set to its initial value. So border:none; will actually have the initial line-width value added:

border: medium none;

However, the line-style value of none will cause the color and width values to be ignored as stated in the CSS Specification:

‘none’ No border. Color and width are ignored (i.e., the border has width 0).

Upvotes: 6

Just having border: none; or border: 0; is enough. You can find more information about the border shorthand here.

Upvotes: 2

Related Questions