The scroll-margin-inline-start property offsets a scroll target at the inline-start edge. It is useful when the leading side of an element should not sit flush against the viewport or scroll container when scrolled into view.
01
inline-start
Logical leading edge.
02
offset
Scroll stop space.
03
length
px, rem, %.
04
target
On the element.
05
carousel
First slides.
06
snap
Horizontal panels.
Fundamentals
Introduction
The scroll-margin-inline-start property in CSS is used to set the scroll offset at the inline-start edge of an element when it is scrolled into view. Along the inline axis, this is typically the left side in horizontal left-to-right writing modes.
This property is particularly useful when you want to adjust the scroll position so content is not too close to the inline-start edge of the viewport or scroll container when it is brought into view.
Definition and Usage
Apply scroll-margin-inline-start to the element being scrolled to — not to the scroll container itself. It works with anchor links, scrollIntoView(), focus navigation, and scroll snapping.
It is one longhand of the scroll-margin-inline shorthand. Use it when only the inline-start side needs adjustment.
💡
Beginner Tip
On a normal English webpage, scroll-margin-inline-start: 20px often behaves like left-side scroll padding for the target element.
Foundation
📝 Syntax
The syntax for the scroll-margin-inline-start property is straightforward. You can specify the margin value using any valid CSS length unit.
Here, length can be a value in pixels (px), em units (em), rem units (rem), percentages (%), or any other valid CSS length unit.
Basic Example
inline-start.css
.item{scroll-margin-inline-start:20px;}
Related Properties
scroll-margin-inline-end — offset at the inline-end edge
scroll-margin-inline — shorthand for start and end
scroll-margin-left — physical left offset
Defaults
🎯 Default Value
The default value of the scroll-margin-inline-start property is 0. This means that, by default, there is no additional margin applied at the inline-start edge when the element is scrolled into view.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
0
LTR horizontal writing
Usually left scroll offset
Part of
scroll-margin-inline shorthand
Accepted values
Lengths and percentages
Inherited
No
Animatable
No
Reference
💎 Property Values
Value
Example
Description
length
scroll-margin-inline-start: 20px;
A specific length value, such as 10px, 2em, 1rem, etc.
percentage
scroll-margin-inline-start: 10%;
A percentage of the containing block’s inline size, such as 10%.
20px2rem10%
Context
When to Use scroll-margin-inline-start
scroll-margin-inline-start helps when the inline-start side of a target needs breathing room:
First carousel slide — Keep the opening card from hugging the container’s leading edge.
Horizontal snap rows — Add space before the first snapped item when swiping sideways.
Scroll targets in panels — Prevent targets from stopping flush against the inline-start edge.
Logical layouts — Prefer inline-start over hard-coded left in international sites.
For the inline-end side (usually right in LTR), use scroll-margin-inline-end instead.
Preview
👀 Live Preview
Scroll sideways in the demo. Each item uses scroll-snap-align: center and scroll-margin-inline-start: 1.25rem.
1
2
3
4
Inline-start margin creates leading-edge breathing room when each item snaps into view.
Hands-On
Examples Gallery
Start with the reference scroll target example, add inline-start space on the first snap slide, improve a carousel opening panel, and use the longhand on one slide only.
📜 Inline-Start Offset
Add space at the inline-start edge when an element is scrolled into view — matching the reference example.
Example 1 — scroll-margin-inline-start in a container
In this example, we’ll add a margin of 20px to the inline-start edge of a target element when it is scrolled into view.
index.html
<style>.container{width:200px;height:200px;overflow:auto;border:1px solid #334155;}.content{width:500px;height:500px;}.target{scroll-margin-inline-start:20px;background-color:lightblue;width:100px;height:100px;margin:200px 0;}</style><divclass="container"><divclass="content"><divclass="target">Scroll to me</div></div></div>
/* These are equivalent when only inline-start matters */.a{scroll-margin-inline-start:2rem;}.b{scroll-margin-inline:2rem0;}
🧠 How scroll-margin-inline-start Works
1
Scroll target is selected
A link, script, or snap rule focuses on an element with scroll-margin-inline-start.
Target
2
Inline-start snap area grows
The browser adds the specified offset beyond the element’s inline-start edge.
Offset
3
Scroll position settles
The element lands with the extra inline-start space visible in the scrollport.
Position
=
★
Comfortable inline-start stops
Targets near the leading edge no longer feel cramped against the container side.
Compatibility
Browser Compatibility
The scroll-margin-inline-start property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ Logical scroll margins · Modern support
Reliable inline-start support
Current Chrome, Firefox, Safari, Edge, and Opera support scroll-margin-inline-start.
97%Modern browser support
Google Chrome69+ · Desktop & Mobile
Full support
Mozilla Firefox68+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera56+ · Modern versions
Full support
Testing tip
Test first-slide and carousel anchor jumps on mobile browsers to confirm the inline-start offset feels right.
scroll-margin-inline-start property97% supported
Bottom line:scroll-margin-inline-start is safe to use in modern projects for scroll targets near the inline-start edge.
Wrap Up
Conclusion
The scroll-margin-inline-start property is a useful tool for adjusting the scroll position of elements within a scroll container.
By setting an appropriate margin, you can ensure that content is displayed at a comfortable distance from the inline-start edge of the viewport, enhancing the overall user experience. Experiment with different margin values to see how this property can improve the layout and accessibility of your web projects.
Apply scroll-margin-inline-start on the scroll target element
Use it on the first carousel slide or opening horizontal snap panel
Prefer logical inline-start over hard-coded left when possible
Test with scrollIntoView() and anchor links
Combine with horizontal scroll-snap-type for carousels
❌ Don’t
Set it on the scroll container expecting container padding
Confuse it with margin-inline-start layout spacing
Assume inline-start always equals left in every writing mode
Use huge percentages without testing on small screens
Forget inline-end offset when the trailing edge also needs space
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about scroll-margin-inline-start
Use these points when offsetting inline-start scroll targets.
5
Core concepts
★01
0 Default
No offset.
Default
⚙02
inline-start
Logical edge.
Axis
◉03
longhand
One side.
Detail
▦04
carousel
First slides.
Use case
🔄05
inline
Shorthand pair.
Companion
❓ Frequently Asked Questions
scroll-margin-inline-start adds scroll offset at the inline-start edge of an element when it is scrolled into view. In horizontal left-to-right writing mode, that usually means the left side.
left is a physical direction. inline-start is logical and follows the document inline direction, so it stays correct in RTL and vertical writing modes.
scroll-margin-inline is a shorthand for both inline-start and inline-end. scroll-margin-inline-start sets only the inline-start side.
The default value is 0, meaning no extra inline-start offset is applied.
Use it when the inline-start side of a scroll target should stop before the container edge, such as for the first carousel slide, opening horizontal snap panel, or targets inside sideways scroll areas.