# Logical Properties

> The logical properties in CSS define sizes, margins and positions relative to the writing direction instead of physical sides.

## What are CSS logical properties?

The properties like `margin-inline-start`, `padding-block` and `inset-inline-end` that follow the text direction instead of left and right. A layout written with them flips automatically for right-to-left languages.

- Topic: Basics
- Type: concept
- Browser support: Chrome 87+, Chrome Android 87+, Edge 87+, Firefox 66+, Firefox Android 66+, Safari 14.1+, Safari iOS 14.5+

## Example

Wrong:

```css
.icon {
  margin-right: 8px;
  padding-left: 1rem;
}
```

Right:

```css
.icon {
  margin-inline-end: 8px;
  padding-inline-start: 1rem;
}
```

Logical sides follow the text direction, so the spacing flips correctly in right-to-left pages.

## Common mistakes

- Mixing physical and logical properties for the same side, so styles fight each other.

## Key points

- Spacing next to text uses `margin-inline-start`, not `margin-left`.
- Icons and arrows that show direction flip in right-to-left layouts.

## Interview questions

### What is the difference between inline and block in logical properties?

Inline is the direction text runs in a line; block is the direction lines stack. In English, inline is horizontal and block is vertical.

### Is `inset-inline` the logical version of `left` and `right`?

Yes, `inset-inline-start` and `inset-inline-end` replace `left` and `right` and follow the writing direction.

## Related cards

- [writing-mode](https://wonderium.dev/css/writing-mode.md)
- [\[dir\]](https://wonderium.dev/html/dir.md)
- [RTL](https://wonderium.dev/web/rtl.md)
- [border-inline](https://wonderium.dev/css/border-inline.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/logical-properties
- Last updated: 2026-11-25
