Some of my CSS dogmata

This is a draft!

Spacing

  • Parent defines margin of its child component
  • Child defines padding of itself
  • Prefer one direction per axis for margin. I use margin-bottom to set the margin on the y/block-axis, and margin-right for x/inline-axis.

Utility first, does not mean utility only

Think functional when making utility classes

Composition, composition, composition

First published 2025-09-12
Last updated
Filed under
  • quicknote
  • css
  • rule-of-thumbs