CSS inset-inline Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The inset-inline property is a logical shorthand for inset-inline-start and inset-inline-end. It offsets a positioned element along the inline axis.

In horizontal left-to-right text it usually matches left and right. With direction: rtl or writing-mode: vertical-rl, the same values map to different physical edges. It has no effect on static elements.

Baseline · Widely available.

Not deprecated and not experimental. Logical inset properties have been widely available across browsers since April 2021. Internet Explorer does not support them.

CSS Syntax

syntax.css
inset-inline: <length> | <percentage> | auto | initial | inherit;

One value sets start and end the same. Two values set start first and end second. Each longhand starts as auto. The property is not inherited.

Property Values

ValueDescriptionTry it
One valueSame offset on inline-start and inline-endTry it
Two valuesFirst = inline-start, second = inline-endTry it
With writing-modePhysical edges change when writing mode is verticalTry it
Needs positionWithout a positioned value, inset-inline does nothingTry it
initialResets both sides to autoTry it
inheritUses the parent’s inset-inline valueTry it

How to Use inset-inline

Position the element, then set inline-axis offsets.

  1. Make a containing block if needed (position: relative on the parent).
  2. Set the child to position: absolute (or another non-static value).
  3. Add inset-inline with one or two lengths/percentages.
  4. Optionally change direction or writing-mode to see which physical edges move.
PieceRequired?Role
position ≠ staticYesWithout it, inset-inline is ignored
1–2 valuesYesOne = both sides; two = start then end
direction / writing-modeOptionalChanges which physical edges get the offsets
Block axisSeparateUse inset-block for the other axis

Live Preview

The blue box is position: absolute. Change only inset-inline. Top/bottom stay fixed so you can see the inline stretch.

In horizontal LTR text, these offsets act like left and right.

Box

inset-inline: 16px

CSS Examples

Each snippet focuses on inset-inline. Position is required so the offsets apply. Use Try It Yourself for a live editor.

Example 1 — Same Offset on Both Inline Sides

In horizontal LTR text, this insets left and right equally.

CSS
<style>
  .stage { position: relative; height: 140px; border: 1px dashed #94a3b8; }
  .box {
    position: absolute;
    top: 16px;
    bottom: 16px;
    inset-inline: 16px;
    background: #2563eb;
    color: #fff;
  }
</style>

<div class="stage">
  <div class="box">inset-inline: 16px</div>
</div>
Try It Yourself

How It Works

  1. Position the child. absolute inside a relative stage.
  2. Set both inline sides. One value applies to start and end.
  3. Map in LTR horizontal mode. That means left and right get 16px.
  4. Give block size separately. top/bottom (or inset-block) span the height here.

Example 2 — Different Start and End

First value is inline-start. Second is inline-end.

CSS
<style>
  .stage { position: relative; height: 140px; border: 1px dashed #94a3b8; }
  .box {
    position: absolute;
    top: 16px;
    bottom: 16px;
    inset-inline: 8px 32px;
    background: #2563eb;
    color: #fff;
  }
</style>

<div class="stage">
  <div class="box">8px start, 32px end</div>
</div>
Try It Yourself

How It Works

  1. Pass two lengths. Order is start, then end.
  2. Smaller start gap. 8px on inline-start (left in LTR).
  3. Larger end gap. 32px on inline-end (right here).
  4. Same property, two jobs. You do not need separate start/end longhands for this pattern.

Example 3 — Vertical Writing Mode

With vertical-rl, inline offsets map to the top and bottom edges.

CSS
<style>
  .stage {
    position: relative;
    height: 160px;
    border: 1px dashed #94a3b8;
    writing-mode: vertical-rl;
  }
  .box {
    position: absolute;
    inset-block: 12px;
    inset-inline: 16px 32px;
    background: #2563eb;
    color: #fff;
  }
</style>

<div class="stage">
  <div class="box">Follows inline axis</div>
</div>
Try It Yourself

How It Works

  1. Switch writing mode. vertical-rl turns the inline axis sideways.
  2. Keep the same logical rule. inset-inline still means start and end on the inline axis.
  3. Physical edges change. Those offsets now land on top and bottom.
  4. Why logical helps. One rule works in horizontal and vertical layouts.

Edge Cases & Pitfalls

If the offsets look wrong, check these first.

position

Static elements ignore inset-inline

Set position to relative, absolute, fixed, or sticky first.

axis

Only the inline axis

This property never sets top/bottom in horizontal text. Use inset-block for the block axis, or inset for all four physical sides.

order

Two values are start then end

inset-inline: 8px 32px means 8px on inline-start and 32px on inline-end. In RTL, start is the right edge.

mode

Direction and writing mode change the edges

Do not assume “always left and right.” Check direction and writing-mode.

physical

inset is physical; this is logical

inset always maps to top/right/bottom/left. Prefer inset-inline when the inline axis should follow writing mode and direction.

Browser Support

inset-inline is a browser CSS property for logical positioned offsets. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

inset-inline

Chrome 87+, Edge 87+, Firefox 63+, Safari 14.1+. Internet Explorer has no support — fall back to left/right (or top/bottom in vertical modes).

96% Modern browser support
Google Chrome 87+
Full support
Mozilla Firefox 63+
Full support
Apple Safari 14.1+
Full support
Microsoft Edge 87+
Full support
Opera 73+
Full support
Samsung Internet 14+
Full support
Internet Explorer No support
Not supported
inset-inline Widely supported

Bottom line: Safe for modern sites. For Internet Explorer, use left and right (or the matching physical pair). It is not a runtime API.

Key Takeaways

  • Role: set logical inline-start and inline-end offsets together.
  • Needs position: relative, absolute, fixed, or sticky.
  • One or two values: one for both sides; two for start then end.
  • Follows writing mode: not always left/right physically.

One line: positioned box + inset-inline: 8px 32px; = logical inline offsets that adapt with writing mode and direction.

Frequently Asked Questions

It is a shorthand for inset-inline-start and inset-inline-end. It sets logical offsets along the inline axis of a positioned element.
Each side defaults to auto, the same as the longhands. Placement then follows other positioning rules.
In horizontal LTR writing mode it usually matches left and right. When direction is rtl or writing-mode is vertical, the same rule maps to different physical edges.
No. It only affects elements with position set to relative, absolute, fixed, or sticky.
inset always sets physical top, right, bottom, and left. inset-inline only sets the logical inline axis and follows writing-mode and direction.
It is Baseline Widely available. Chrome 87+, Edge 87+, Firefox 63+, and Safari 14.1+ support it. Internet Explorer does not. It is a browser CSS property, not a Node.js feature.

Next: inset-inline-end

Set only the logical inline-end offset on a positioned element.

inset-inline-end tutorial →

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.

9 people found this page helpful