John Himmelman John Himmelman - 7 months ago 54
CSS Question

Should I use 'border: none' or 'border: 0'?

Which of the two methods conforms to W3C standards? Do they both behave as expected across browsers?

border: none;

border: 0;

Oli Oli

Either is valid. Your choice but I would favour border:0 as it's shorter. If you have a lot of traffic, you'll notice the difference!

You seem to be worried about the specs. Well here they are.

    Value:      [ <border-width> || <border-style> || <'border-top-color'> ] | inherit
    Initial:    see individual properties
    Applies to:     all elements
    Inherited:      no
    Percentages:    N/A
    Media:      visual
    Computed value:     see individual properties 

The value clearly states that you can use any combination of width/style/colour. In this case you only need to set one. 0 sets the width, none the style.