If you ever wonder in what order to enter your CSS attributes like border
, padding
, font-family
, etc. Two common approaches seem to be Alphabetical and Box Model. (See:
Conventional Order of CSS properties)
This not to be confused with selectors (#id
, .class
, :hover
, tagname
) in which case the order matters very much.
The Alphabetical option does not make much sense to me. For one thing it sticks padding
and line-height
in the middle of width
and height
or left
and top
.
I will post a CW answer with the list from fordinteractive.com which was provided by jacobangel.
It is very nice, but it is not complete. There are a few items missing. I hope to find out where the missing ones go like font-style
and clip
.
Where should these new ones go in the list? Are there any others that are missing? If there was already a suggestion for the same thing then vote for that comment to show you think it is a good idea. Also there will probably be more that are missing. I hope for this to be a complete list. It would also be a good idea if there was a tool or IDE feature that would sort by this list.
I am posting this because there does not seem to be another page that can be found on Google and the one I do know of is incomplete (not even on Google that I could find). I expect that if new ones are edited in that we will have a complete list that everyone can follow.
Box Model Convention copied from http://fordinteractive.com/tools/propertyorder/propertyorder.css.
Additions should be edited in when they are found to be missing from the list. Please comment on where you think that additions and wait for some agreement before adding them to the final list.
clip
go?user-select
go? (not supported except by Mozilla with-moz-user-select
and Chrome with-webkit-user-select
. IE uses JavaScriptonselectstart
)border-radius
go? (not supported except by Mozilla with-moz-border-radius
and Chrome with-webkit-border-radius
)Please comment if you have a suggestion as to where something should go.