# Write better CSS to improve your code quality

Canonical URL: https://aerolab.co/blog/write-better-css-to-improve-your-code-quality
Published: 2020-10-08
Author: Lucas Romero Di Benedetto
Last reviewed: 2026-11-19

This short article proposes a shared order for CSS declarations to make styles easier to read, discuss and maintain across a team. It addresses inconsistent organization within selectors, rather than introducing a styling framework.

## The grouping convention

The examples arrange declarations into these groups:

1. Layout, such as flex behavior and alignment.
2. Position and dimensions.
3. Margin and padding.
4. Box appearance, including background, border and shadow.
5. Typography and text color.
6. Other behavior, such as overflow and cursor.

Whitespace separates the groups. The article contrasts the same collection of properties written without a clear order and written according to the convention, then shows a smaller selector using the same idea.

The intended benefit is a predictable place to find a property, easier refactoring and fewer overlooked redundancies. This is the author's 2020 team convention, not a CSS language requirement or evidence of a runtime performance improvement.

For a related discussion of maintainable shared knowledge, read [software documentation](https://aerolab.co/blog/documentacion-software.md).
