I have always done this. Ordering CSS properties in any rule I have written just gets done in alphabetical order. There was no real reason why I did this, but some kind of subconscious decision was made, and it’s now always how I have done it.
A few years back, a work colleague questioned why I ordered my CSS properties like this. When I actually thought about it, it just made logical sense to me. Everyone knows the alphabet, they learn it in school and it’s a common foothold for anyone, whether they be a CSS master, or just starting out to learn (I think it may actually help people pick CSS more easily myself).
But today I saw a conversation pop up on Twitter about ordering properties in your CSS (which began with this tweet).
From what I can gather, people order their CSS properties in the following ways:
- Chronologically (new properties added to the bottom of the list)
- According to the box model
I’m not usually one to start a conversation, but thought this would benefit from input from more developers than those in the conversation on Twitter.
So, what do you do? And what do you think is best?
N.B. I’m not trying to get every developer to come up with a set of standards, but to see how other people work and what the benefits are of the different approaches.