Logical properties provide writing-mode aware alternatives to physical properties like left, right, top, and bottom. Here's how to use them for better internationalization.
Physical vs Logical#
Inline and Block Axes#
Margin Properties#
Padding Properties#
Border Properties#
Border Radius#
Inset Properties#
Text Alignment#
Float and Clear#
Overflow#
Complete Component Example#
Navigation Component#
Form Layout#
Best Practices#
When to Use:
✓ Multi-language applications
✓ RTL language support
✓ Component libraries
✓ New projects from scratch
Migration:
✓ Start with new components
✓ Replace gradually
✓ Test with dir="rtl"
✓ Use CSS logical shorthands
Naming Reference:
block-start → top (horizontal-tb)
block-end → bottom (horizontal-tb)
inline-start → left (LTR) / right (RTL)
inline-end → right (LTR) / left (RTL)
Avoid:
✗ Mixing physical and logical randomly
✗ Forgetting vertical writing modes
✗ Ignoring browser support
✗ Over-complicating simple layouts
Conclusion#
CSS logical properties provide writing-mode aware alternatives to physical properties, making layouts automatically adapt to RTL languages and vertical writing modes. Use inline-* for horizontal flow, block-* for vertical flow, and start/end instead of left/right. This approach simplifies internationalization and creates more maintainable, direction-agnostic CSS for modern multilingual applications.