concept

logical-properties — CSS reference

Logical properties target flow-relative dimensions, edges and corners instead of fixed physical sides. They share cascade groups with physical counterparts: when both target the same edge, the winning declaration is determined by cascade order. Avoid mixing them accidentally; use logical spacing for direction-independent components.

Formal Syntax & Structure

css syntaxcss
inline-size: 70px; block-size: 40px; padding-inline-start: 12px

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS logical layout lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#a,#b,#c{box-sizing:content-box;writing-mode:horizontal-tb;width:100px;height:80px} #c{writing-mode:vertical-rl;direction:ltr} #a,#b,#c{inline-size:70px;block-size:40px;padding-left:5px;padding-inline-start:12px}</style><body><div id="a" class="sample" dir="ltr">Start</div><div id="b" class="sample" dir="rtl" lang="fa">شروع</div><div id="c" class="sample" lang="ja">縦書き</div></body></html>
CSS Reference