Course contentsShow
← Web Development
Lesson 461 of 2,9828. Advanced CSS Selectors and FeaturesFree lesson

Logical Position Properties (inset)

Use inset-block and inset-inline to position elements relative to flow direction instead of physical edges.

Logical Position Properties (inset)

What you'll learn: How to position elements relative to the document's reading direction using logical properties instead of physical edges.


When you've previously used position: absolute or position: fixed, you've likely used physical properties like top, right, bottom, and left to place elements. These work great for English websites, but they're tied to the physical screen edges—not the flow of your content.

The Problem with Physical Properties

In languages that read right-to-left (like Arabic) or have different writing modes, left: 0 doesn't mean "start of the line"—it literally means the left edge of the screen. This creates layout issues in multilingual sites.

Enter Logical Inset Properties

The logical equivalents respect the block (vertical in English) and inline (horizontal in English) axes of your document's flow:

  • inset-block-start – positions from the block-start edge (top in English)
  • inset-block-end – positions from the block-end edge (bottom in English)
  • inset-inline-start – positions from the inline-start edge (left in LTR, right in RTL)
  • inset-inline-end – positions from the inline-end edge (right in LTR, left in RTL)

You can also use shorthands:

  • inset-block – sets both start and end
  • inset-inline – sets both start and end
  • inset – sets all four at once (block-start, inline-end, block-end, inline-start)

Example

.positioned-box {
  position: absolute;
  inset-block-start: 1rem;    /* 1rem from top in English */
  inset-inline-end: 2rem;     /* 2rem from right in LTR */
}

If the page switches to RTL, inset-inline-end automatically means "2rem from the left" instead—no CSS changes needed!

Key Takeaway: Use inset-block and inset-inline properties to position elements relative to content flow direction, making your layouts automatically adapt to different writing modes and languages.