Logical Properties and Writing Modes: inline, block, start and end
Logical properties name sizes, margins, padding, borders, radii and offsets by the inline and block axes, so layouts adapt to right-to-left and vertical text: the mapping, shorthands, logical keywords, and when physical properties fit.
kvi5hnuCode Sprout team member8 min readOn this page
margin-left means the left side of the screen, whatever the language. In English that's where lines start, but in Arabic or Hebrew lines start on the right, and in vertical Japanese they start at the top. Logical properties describe sides by their role in the text instead: the inline axis that lines run along, the block axis that blocks stack along, and the start and end of each. A layout written with them adapts to any language direction without extra rules.
The two axes

Two properties set the directions (article 92 covers them in depth):
direction:ltrorrtl, the direction of the inline axis. Set it in HTML with thedirattribute,<html dir="rtl">, not in CSS, since it's part of the content's meaning.writing-mode:horizontal-tb(the default: lines horizontal, blocks top to bottom),vertical-rl(lines top to bottom, blocks right to left, as in Japanese and Chinese), orvertical-lr.
Logical properties follow these two. With direction: rtl, margin-inline-start becomes the right margin; with writing-mode: vertical-rl, it becomes the top margin. The mapping is resolved on the element's own writing mode and direction, which it usually inherits.

Only the dir or writing-mode changes between the first three cards. The physical version, last, shows what breaks without logical properties: the border marks the end of the line, and the badge sits on top of where the text starts.
The mapping
In the default left-to-right, horizontal mode:
| Logical | Physical (ltr, horizontal) |
|---|---|
inline-size, min-inline-size, max-inline-size | width, min-width, max-width |
block-size, min-block-size, max-block-size | height, min-height, max-height |
margin-inline-start, margin-inline-end | margin-left, margin-right |
margin-block-start, margin-block-end | margin-top, margin-bottom |
padding-inline-*, padding-block-* | padding-left/right, padding-top/bottom |
border-inline-start, border-block-end, ... | border-left, border-bottom, ... (also their -width, -style, -color) |
inset-inline-start, inset-block-start | left, top |
border-start-start-radius | border-top-left-radius (block-start, inline-start corner) |
border-start-end-radius, border-end-start-radius, border-end-end-radius | top-right, bottom-left, bottom-right |
overflow-inline, overflow-block | overflow-x, overflow-y |
scroll-margin-inline, scroll-padding-block, overscroll-behavior-inline, contain-intrinsic-inline-size | the matching -x/-y or side properties |
All of these are Baseline. Most have been in every browser since 2021; overflow-inline and overflow-block reached Safari in 2025.
Shorthands
Each axis has a shorthand taking one or two values, start then end:
.card {
margin-block: 1rem 2rem; /* block-start 1rem, block-end 2rem */
margin-inline: auto; /* center horizontally: both inline margins auto */
padding-inline: 1.5rem; /* both inline sides */
border-block: 1px solid #d8cfc0;
inset-inline: 0; /* left: 0; right: 0 in horizontal modes */
}
inset sets all four of top, right, bottom, left (physical, in that order): inset: 0 fills the containing block. inset-block and inset-inline are its logical halves.
There's no logical version of the four-value margin or padding shorthand yet: margin: 1rem 2rem 3rem 4rem is always top, right, bottom, left. A logical keyword was proposed but isn't in any browser. Use the two-axis shorthands instead.
Logical keywords
Some properties take logical values instead of having logical names:
| Property | Logical values | Physical equivalents |
|---|---|---|
text-align | start, end | left, right |
float, clear | inline-start, inline-end | left, right |
resize | inline, block | horizontal, vertical |
text-align: start is the initial value, which is why right-to-left text aligns right without any CSS. float: inline-start reached Chrome in 2023, so it's Baseline.
Try it
body { font: 0.95rem/1.5 system-ui, sans-serif; margin: 1rem; display: grid; gap: 0.75rem; }
.card {
max-inline-size: 20rem;
padding-block: 0.5rem;
padding-inline: 1rem 0.75rem;
border-inline-start: 5px solid #8a3b12;
border-start-end-radius: 12px;
border-end-end-radius: 12px;
background: #f4efe6;
}
h3 { margin-block: 0 0.25rem; color: #8a3b12; }
p { margin-block: 0 0.5rem; }
a { color: #2f7d4f; }
.vertical { writing-mode: vertical-rl; block-size: 9rem; }
The same rules put the accent border on the left in English, on the right in Arabic, and on top in vertical Japanese, with the rounded corners always opposite it. Written with border-left and border-top-right-radius, the Arabic and Japanese cards would need their own overrides.
Mixing logical and physical properties
A logical property and its physical equivalent set the same value, so they override each other by the cascade's usual rules, in source order when specificity is equal:
.box {
margin-left: 2rem;
margin-inline-start: 1rem; /* later: wins in ltr, where it's the same side */
}
In right-to-left text, the two set different sides, so both apply.

The left-to-right box has one margin, because the later declaration replaced the earlier one; the right-to-left box has two. Mixing them makes that hard to follow, so pick one system per component.
When physical properties are right
Logical properties are about text direction. Use physical properties when something is tied to the screen or to the image, not the writing:
- A shadow lit from above,
box-shadow: 0 4px 8px ....box-shadowhas no logical form anyway. - A sticky header at the top of the viewport (
top: 0), or a mobile toolbar at the bottom. - Directional images and animations whose meaning doesn't flip, such as a play icon or a progress bar that fills left to right in all languages.
- Transforms (
translateX), gradients (to right) andbackground-positionare physical only. If they need to flip in right-to-left pages, use:dir(rtl)(article 11), which matches the element's direction:
.next-icon:dir(rtl) { transform: scaleX(-1); } /* point the arrow the other way */
For everything that follows text, such as spacing, alignment, borders that mark where a line starts, and widths that limit line length, logical properties are the better default, even for sites in one language: they read as intent ("the start of the line"), and they're ready if the site is translated.
Writing modes and sizing
inline-size and block-size follow the writing mode, which is what you usually want: max-inline-size: 65ch limits line length in any writing mode. Percentages for inline-size refer to the containing block's inline size.
In vertical writing, width is still the physical width, which is the block size, and block sizes are usually set by content. That's why width and height on a vertical element feel swapped: logical sizes avoid the confusion.
Viewport units also have logical forms: vi and vb are 1% of the viewport's inline and block size (article 25).
What's current
- All the logical sizing, margin, padding, border, inset and radius properties are Baseline widely available.
floatandclearwithinline-startandinline-endare Baseline since Chrome 118 (2023).overflow-inlineandoverflow-blockare in all browsers since 2025.- A logical form of the four-value
marginandpaddingshorthands is still only a proposal.
Common questions
Do I need logical properties if my site is only in English? Not strictly, but they cost nothing, express intent, and make translation into right-to-left languages work without new CSS. Many teams use them by default.
Should I set direction: rtl in CSS?
No. Use the dir attribute in HTML, because direction is part of the content, and screen readers and form controls use it too.
How do I center a block with logical properties?
margin-inline: auto, with an inline-size or max-inline-size set.
Why didn't margin-inline-start override my margin-left in Arabic?
In right-to-left text, margin-inline-start is the right margin, so it doesn't compete with margin-left at all; both apply.
Is inset a logical property?
No. inset is a physical shorthand for top, right, bottom and left. inset-inline and inset-block are the logical ones.
Summary
- Logical properties name sides by the inline axis (lines) and the block axis (stacking), and their start and end. They follow
directionandwriting-mode. - Every physical size, margin, padding, border, radius and offset property has a logical equivalent, plus two-value axis shorthands such as
margin-inlineandpadding-block. text-align: start,float: inline-startandresize: blockare logical values.- Logical and physical properties for the same side override each other in the cascade.
- Use physical properties for things tied to the screen, such as shadows and sticky headers; use
:dir(rtl)to flip transforms and icons.
Practice questions
Rewrite with logical properties so it works in right-to-left text.
.quote {
border-left: 4px solid #8a3b12;
padding-left: 1rem;
margin: 1rem 0;
text-align: left;
}
Answer
.quote {
border-inline-start: 4px solid #8a3b12;
padding-inline-start: 1rem;
margin-block: 1rem;
margin-inline: 0;
text-align: start;
}
In a writing-mode: vertical-rl element, which physical side does padding-block-start set?
Answer
The right side. In vertical-rl, blocks stack from right to left, so block-start is on the right.
A component sets margin-left: 2rem and then margin-inline-start: 0 in a later rule with the same specificity. What's the left margin in English, and in Arabic?
Answer
In English, 0: both set the left margin, and the later one wins. In Arabic, 2rem: margin-inline-start sets the right margin there, so the left margin keeps 2rem.
A "next" arrow icon should point the other way in right-to-left pages. Write the CSS.
Answer
.next-icon:dir(rtl) { transform: scaleX(-1); }
Review quiz
Test yourself on Part 6 with the CSS Part 6 review quiz.
Previous: Hiding and Showing: display: none, visibility, display: contents and content-visibility
Next: Backgrounds: Colors, Images, Position, Size, Repeat, Clip and Origin

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.