brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: margin-inline: auto and other css logical properties follow the writing direction

Css
~/tips/tip-css-logical-properties-inline-block

.container { max-inline-size: 70ch; margin-inline: auto; padding-block: 2rem; }

Replaces left, right, top and bottom with properties that follow the text direction.

Physical left and right values break as soon as a page is shown right to left.

.container { max-inline-size: 70ch; margin-inline: auto; padding-block: 2rem; }
blockquote { border-inline-start: 4px solid currentColor; }

Logical properties name the inline axis (the direction text flows) and the block axis (where new lines stack) instead of left, right, top and bottom. margin-inline: auto centres a box, padding-block sets top and bottom, and border-inline-start sits on the left in English and on the right in Arabic or Hebrew. In a vertical writing mode the axes rotate as well. They are supported everywhere, so there is no need to keep both versions of a rule.

Further reading: MDN: CSS logical properties and values

More Css tips CSS Overview in Chrome DevTools audits the colors and fonts of a page .notice:empty { .toast { article { counter-reset: h2; } .toolbar { All Css tips (66) All topics

Link