Day 206 - Please, stop using NON-logical CSS properties!

Day 206 - Please, stop using NON-logical CSS properties!

🎉 An Awesome CSS Link a Day - Day 206 🎉

Please, stop using NON-logical CSS properties!

#AnAwesomeCSSLinkADay #YouDontMessWithCSS #CSS

Hello there 👋 Today we tackle a hot topic in modern CSS: should developers completely abandon non‑logical properties in favor of logical ones? With the rise of internationalization and responsive design, the debate has never been more relevant.

📐 Theory: Logical vs. Non‑Logical Properties

When styling layouts, developers often rely on physical properties like margin-left or padding-top. However, modern CSS provides logical properties that adapt to writing modes, text direction, and international layouts. Understanding when to use them is crucial for accessibility and maintainability.

  1. Physical (Non‑Logical) Properties: these are the traditional CSS properties like margin-left, border-top, or text-align: right. They assume a left‑to‑right, top‑to‑bottom writing mode, which can break in RTL (right-to-left) or vertical text contexts
  2. Logical Properties: logical properties such as margin-inline-start, padding-block-end, and inset-inline adjust automatically to writing mode and direction. This ensures layouts remain consistent across languages without rewriting CSS
  3. Practical Considerations: while logical properties are more future‑proof, some non‑logical ones are still easier to read or necessary for legacy support. The real question is not about complete replacement, but about choosing the right tool in context

🚀 Today’s Link

For a thoughtful exploration of this debate, check out this article by Frontend Masters:

🔗 Should We Never Use Non‑Logical Properties?

It dives deep into the trade‑offs, showing why logical properties are key to modern CSS while recognizing the role of non‑logical ones in certain use cases.

💫 Giveaways

  • Clear breakdown of logical vs. non‑logical properties
  • Insights into writing mode adaptability for multilingual layouts
  • Guidance on balancing future‑proof CSS with legacy support
  • Practical examples to illustrate real‑world trade‑offs

❓ Why This Rocks

  • Makes your CSS more resilient across different languages and layouts
  • Helps you future‑proof your designs for global audiences
  • Reduces maintenance by avoiding hard‑coded directional properties
  • Encourages smarter, more inclusive styling choices

🗣️ Join the Conversation

  • Do you already use logical properties in your projects?
  • Have you encountered issues with RTL or vertical text that logical properties solved?
  • Where do you think non‑logical properties still make sense?
  • Will logical properties eventually replace physical ones entirely?

Let’s discuss how logical properties are shaping the future of CSS internationalization! 🚀

Massimo Artizzu

Web Architect presso Antreem S.r.l.

1w

It's a pity that many shorthand properties do _not_ suppor logical properties, like `margin` or `inset`. This means `margin: 1px 2px 3px 4px` will always mean the top margin is 1px, then the right is 2px, the bottom is 3px and the left is 4px. Likewise, `translate` too is a translation from the _left_ and the _top_, regardless of the flow direction, and we don't even have a `translate-block`/`translate-inline`. Even new stuff like `shape()` isn't affected by the direction. Maybe I should write an article about it...

Emiliano Pisu

🎥 Sensei & Co-Host @ DevDojo IT 🎤 Speaker ♿️ Accessibility WCAG Expert ✨ Turning Designs into interactive things 🦸♂️ Your friendly neighborhood Design Engineer

1w
Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics