CSS inset-inline Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout & Positioning

What You’ll Learn

The inset-inline property sets offsets along the inline axis using logical CSS. It is the inline-axis counterpart to physical left and right properties.

01

Inline Axis

Logical offset.

02

auto

Default value.

03

Shorthand

Start & end.

04

RTL

Adapts direction.

05

absolute

Common use.

06

inset

Related set.

Introduction

The inset-inline property in CSS is a logical property that controls the inline-start and inline-end offsets of a positioned element in one declaration.

It is part of the CSS Logical Properties and Values module, which provides layout properties that work independently of physical directions and adapt to different writing modes and text directions.

Definition and Usage

Apply inset-inline on positioned elements when you want to offset them along the inline axis. In normal horizontal English pages, that usually means left and right offsets.

💡
Beginner Tip

Think of inset-inline as logical left + right. Pair it with inset-block for full logical positioning.

📝 Syntax

The syntax for the inset-inline property accepts one or two values:

syntax.css
element {

  inset-inline: value;

}



element {

  inset-inline: inline-start inline-end;

}
  • One value — applies to both inline-start and inline-end.
  • Two values — first value is inline-start; second is inline-end.

Basic Example

inset-inline-basic.css
.box {

  position: absolute;

  inset-inline: 20px 40px;

  block-size: 3rem;

}
inset-inline: auto; inset-inline: 1rem; inset-inline: 20px 40px; inset-inline: 0;

Default Value

The default value of the inset-inline property is auto, which means the browser determines inline-axis placement from other positioning rules.

Syntax Rules

  • Shorthand for inset-inline-start and inset-inline-end.
  • Only works when position is not static.
  • The property is not inherited.
  • Accepts length, percentage, and auto values.
  • In horizontal LTR writing mode, maps to left and right.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toPositioned elements
InheritedNo
AnimatableYes, as a length
Horizontal LTR writing modeBehaves like left and right

💎 Property Values

ValueDescription
lengthA fixed offset such as 20px, 1em, or 1rem.
percentageAn offset relative to the containing block size on the inline axis.
autoLets the browser calculate the inline offset automatically.

Inline Axis and Text Direction

Logical inset properties follow the document’s writing mode and direction instead of fixed physical sides:

  • Horizontal LTR (dir="ltr") — inline axis is horizontal; inset-inline controls left and right offsets.
  • Horizontal RTL (dir="rtl") — inline-start and inline-end swap sides, but the same CSS rule still works.
  • Related shorthandinset-block handles the block axis, and inset sets all four sides together.
🔄
Logical Positioning Set

Use inset-inline + inset-block together for writing-mode-aware layouts, or inset when you want all offsets in one rule.

👀 Live Preview

An absolutely positioned box with inset-inline: 10px 20px in horizontal LTR writing mode:

Examples Gallery

Set two inline offsets, stretch with inset-inline: 0, use a single value, and see behavior in RTL direction.

🔢 Inline-Axis Offsets

Start with separate inline-start and inline-end offsets on a positioned element.

Example 1 — Two-Value inset-inline

Set inline-start to 20px and inline-end to 40px on an absolutely positioned box.

inset-inline-two.css
.box {

  position: absolute;

  inset-inline: 20px 40px;

  block-size: 3rem;

}
Try It Yourself

How It Works

In horizontal LTR writing mode, the box sits 20px from the left and 40px from the right of its container.

Example 2 — Stretch with inset-inline: 0

Stretch an element fully along the inline axis inside a positioned container.

inset-inline-zero.css
.banner {

  position: absolute;

  inset-inline: 0;

  inset-block-start: 1rem;

  block-size: 2.5rem;

}
Try It Yourself

How It Works

inset-inline: 0 pins both inline edges to the container, creating a full-width banner strip.

📈 Single Value & RTL

Use one value for equal offsets and test logical behavior in right-to-left direction.

Example 3 — Single-Value inset-inline

Apply the same offset to both inline-start and inline-end with one value.

inset-inline-one.css
.box {

  position: absolute;

  inset-inline: 1rem;

  inset-block: 1rem;

}
Try It Yourself

How It Works

One value applies to both inline edges. Combined with inset-block, you get even spacing on all logical sides.

Example 4 — RTL Direction

See how inset-inline still controls inline-axis offsets when text direction is right-to-left.

inset-inline-rtl.css
html {

  direction: rtl;

}



.box {

  position: absolute;

  inset-inline: 12px 36px;

}
Try It Yourself

How It Works

Logical properties follow the inline axis, not fixed left and right directions, so the same rule works in both LTR and RTL layouts.

♿ Accessibility

  • Positioning does not change reading order — DOM order still matters for screen readers.
  • Test RTL and vertical layouts — Logical offsets should not hide essential content.
  • Avoid covering focusable controls — Full-width overlays can block keyboard access.
  • Support zoom on mobile — Fixed inline offsets should not clip important text.
  • Set dir on the document — Correct text direction helps both layout and assistive technology.

🧠 How inset-inline Works

1

Direction defines the inline axis

LTR, RTL, or vertical writing mode determines which physical direction inline-start and inline-end map to.

Text direction
2

inset-inline sets two offsets

One declaration controls both inline-start and inline-end distances for a positioned element.

CSS rule
3

The browser places the element

The box is offset from the containing block along the inline axis.

Layout
=

Logical inline positioning

Layouts adapt cleanly when text direction or writing mode changes.

🖥 Browser Compatibility

The inset-inline property is supported in modern browsers including Chrome 87+, Firefox 63+, Safari 14.1+, and Edge 87+.

Baseline · Modern browsers

Logical positioning in today’s browsers

All major browsers support inset-inline as part of the CSS Logical Properties module.

94% Modern browser support
Google Chrome 87+ · Desktop & Mobile
Full support
Mozilla Firefox 63+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 87+ · Chromium
Full support
Opera 73+ · Modern versions
Full support
inset-inline property 94% supported

Bottom line: Safe for modern logical layouts. Use physical left and right only when legacy support is required.

🎉 Conclusion

The inset-inline property is a valuable addition to CSS, providing flexible control over inline-axis positioning in different writing modes and text directions. It pairs naturally with inset-block and other logical properties for internationalized layouts.

For beginners, start with horizontal LTR pages where it behaves like left and right, then explore RTL direction to see the real advantage of logical CSS.

💡 Best Practices

✅ Do

  • Use with logical sizing properties like inline-size
  • Pair with inset-block for full logical placement
  • Test in RTL and vertical writing modes
  • Use inset-inline: 0 for full inline-axis stretch
  • Set a non-static position value first

❌ Don’t

  • Apply without positioning context
  • Mix logical and physical offsets without reason
  • Assume it works like margin or padding
  • Hide critical content with absolute overlays
  • Forget containing block setup for absolute children

Key Takeaways

Knowledge Unlocked

Five things to remember about inset-inline

Use these points when building logical positioned layouts.

5
Core concepts
auto 02

Default auto

Browser pick.

Default
2 vals 03

Start & end

Shorthand.

Syntax
RTL 04

Direction

Adapts axis.

Pattern
inset 05

Related

Logical set.

Family

❓ Frequently Asked Questions

inset-inline is a logical shorthand that sets inset-inline-start and inset-inline-end offsets along the inline axis of an element.
The default is auto, which lets the browser determine inline-axis placement from other positioning rules.
In horizontal LTR writing mode they often match left and right, but inset-inline follows the inline axis and adapts when direction or writing mode changes.
No. Like inset, it only affects elements with position set to relative, absolute, fixed, or sticky.
No. inset-inline is not inherited.

Practice in the Live Editor

Open the HTML editor, combine inset-inline with logical sizing, and compare LTR versus RTL direction.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful