View Full Version : {border: 1px solid black} or {border: 1px black solid}

02-25-2009, 03:31 PM
I'm used to
border: 1px solid black but then I saw
border: 1px black solid in a tutorial, and I started wondering. Which one is best?

02-25-2009, 03:34 PM
border: 1px solid black;

is it (read here (http://www.dustindiaz.com/css-shorthand/)). If you think about it in a conversational sense it helps to remember. If I saw a black car I wouldn't say to my friend, "That car is black solid;" I would say, "That car is solid black."

For even more precision use the hex code:

border: 1px solid #000

(written using hex code shorthand (http://www.websiteoptimization.com/speed/tweak/hex/))

This is especially important when using colors like "light green" or some such, which may not be consistent cross-browser. With the hex codes you know you'll see the same thing everywhere.

02-25-2009, 03:37 PM
The specification for CSS 2.1 doesn't explicitly state they have to be in a certain order but they are listed like your first example.


02-25-2009, 03:47 PM
Wow, VERY fast replies!

Yea, msuffern, that's what I thought too; it was very logical.

Thanks again to both of you :thumbsup: