New World Order
The other day I was reading a CSS-Tricks article on ordering CSS.
Here are the options:
Randomly
When I developed my teaching websites, I wasn’t concerned about others looking at my code. I started off with this method and didn’t really worry about changing.
By Line Length
I didn’t even know this was a thing until I read the article. As expected, only a small percentage of developers use this method.
By Type
I’m gravitating towards this method: typographical properties first, then sizing, then shadows, then animations, etc. After I jot down, code I spend a few minutes regrouping properties.
Alphabetically
I’m beginning to think that this makes a real difference. I noticed that browser dev tools naturally order object properties alphabetically,so why not CSS? This method would also be ideal when working in a group, since learning a pre-arranged order would waste time. I’m going to gravitate towards this method in the future. I read somewhere that Visual Studio’s ReSharper tool extension orders properties with just a few clicks, so it might be worth checking out for a larger project.