Logical Border Properties
You'll learn how to apply borders that automatically adapt to different writing modes and text directions using flow-relative properties.
The Core Idea
Traditional border properties like border-top, border-right, border-bottom, and border-left are physically tied to the screen's edges. Logical border properties replace these with flow-relative alternatives that respond to the document's writing mode (horizontal vs vertical) and text direction (left-to-right vs right-to-left).
Just like you learned with margins and padding, borders now have logical equivalents:
border-block-start— border at the start edge of the block axis (typically "top" in horizontal writing)border-block-end— border at the end edge of the block axis (typically "bottom")border-inline-start— border at the start edge of the inline axis (typically "left" in LTR)border-inline-end— border at the end edge of the inline axis (typically "right" in LTR)
You can also use shorthand properties:
border-block— sets both block-start and block-endborder-inline— sets both inline-start and inline-end
Think of It This Way
Imagine designing a card with a decorative left border. In English, that's the reading direction's starting edge. But in Arabic (right-to-left), the visual "start" is actually the right side. Using border-inline-start: 4px solid blue; automatically places the border on the correct edge for both languages—no extra CSS needed!
Example Pattern
.highlight-card {
border-inline-start: 4px solid coral;
border-block-end: 1px solid #ddd;
}
In English (LTR), this creates a left border and bottom border. In Arabic (RTL), it creates a right border and bottom border—automatically.
Key Takeaway: Logical border properties use border-block and border-inline to create borders that intelligently adapt to writing mode and text direction, making your designs truly internationalization-ready.