Back to 30 Seconds Of Code

Logical and physical CSS properties equivalents

content/snippets/css/s/logical-physical-properties-map.md

14.0.04.1 KB
Original Source

Logical properties are a new way to define layout in CSS. They allow you to use logical directions (like start, end, inline, and block) instead of physical directions (like left, right, top, and bottom). This makes it easier to create layouts that work well in different writing modes and languages.

<baseline-support featureId="logical-properties"> </baseline-support>

However, if you're used to working with physical properties, it can be a bit confusing at first. To help you out, here's a handy map of logical properties to their physical counterparts!

[!NOTE]

In this article, I'm assuming you're writing from left to right (LTR). If you're writing from right to left (RTL), the physical properties will be reversed. For example, left becomes right, and top becomes bottom.

Position

Logical PropertyPhysical Property (LTR)
inset-inline-startleft
inset-inline-endright
inset-inlineleft & right
inset-block-starttop
inset-block-endbottom
inset-blocktop & bottom

Margin

Logical PropertyPhysical Property (LTR)
margin-inline-startmargin-left
margin-inline-endmargin-right
margin-inlinemargin-left & margin-right
margin-block-startmargin-top
margin-block-endmargin-bottom
margin-blockmargin-top & margin-bottom

Padding

Logical PropertyPhysical Property (LTR)
padding-inline-startpadding-left
padding-inline-endpadding-right
padding-inlinepadding-left & padding-right
padding-block-startpadding-top
padding-block-endpadding-bottom
padding-blockpadding-top & padding-bottom

Border

Logical PropertyPhysical Property (LTR)
border-inline-startborder-left
border-inline-start-colorborder-left-color
border-inline-start-styleborder-left-color
border-inline-start-widthborder-left-color
border-inline-endborder-right
border-inline-end-colorborder-right-color
border-inline-end-styleborder-right-color
border-inline-end-widthborder-right-color
border-inlineborder-left & border-right
border-inline-colorborder-left-color & border-right-color
border-inline-styleborder-left-style & border-right-style
border-inline-widthborder-left-width & border-right-width
border-block-startborder-top
border-block-start-colorborder-top-color
border-block-start-styleborder-top-color
border-block-start-widthborder-top-color
border-block-endborder-bottom
border-block-end-colorborder-bottom-color
border-block-end-styleborder-bottom-color
border-block-end-widthborder-bottom-color
border-blockborder-top & border-bottom
border-block-colorborder-top-color & border-bottom-color
border-block-styleborder-top-style & border-bottom-style
border-block-widthborder-top-width & border-bottom-width
border-start-start-radiusborder-top-left-radius
border-start-end-radiusborder-top-right-radius
border-end-start-radiusborder-bottom-left-radius
border-end-end-radiusborder-bottom-right-radius

Size

Logical PropertyPhysical Property (LTR)
inline-sizewidth
min-inline-sizemin-width
max-inline-sizemax-width
block-sizeheight
min-block-sizemin-height
max-block-sizemax-height

Values

In addition to logical properties, there are also logical values that can be used in a variety of other CSS properties.

Logical ValuePhysical Value (LTR)
startleft
endright
inline-startleft
inline-endright
block-starttop
block-endbottom