Logical Properties in Everyday CSS
Logical properties make spacing work in any writing direction.
Easy swaps
We keep a scratch file of small experiments like this one. Most of them go nowhere, but a few end up in every project.
- margin-inline for horizontal margins
- padding-block for vertical padding
- inset-inline-start for positioning
Clients rarely notice these details directly. They notice that the site feels solid, and that nothing jumps around when it loads.
Left and right are assumptions. Inline and block are facts.
The code is short enough to read in one sitting. That matters, because code you can read is code you can change.
We still get it wrong sometimes. The difference now is that fixing it takes one line instead of an afternoon.
Try it on a small page first, not your whole site. You will learn more from one finished page than a half-finished redesign.
If you build something with this, send it to us. We collect good examples and share the best ones in our reading lists.
We tried this on a client site first, because a real deadline is the only honest test. It held up better than we expected, and the handover notes were half as long as usual.
4 thoughts on “Logical Properties in Everyday CSS”
I would add one thing: check it in dark mode too.
Great write-up. Would love a follow-up on the mobile version.
This changed how I think about borders.
Good question. We cover that in a follow-up post soon.