scroll-padding-left
property defines offsets for the left of the
optimal viewing region
of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
/* Keyword values */ scroll-padding-left: auto; /* <length> values */ scroll-padding-left: 10px; scroll-padding-left: 1em; scroll-padding-left: 10%; /* Global values */ scroll-padding-left: inherit; scroll-padding-left: initial; scroll-padding-left: unset;
<length-percentage>
An inwards offset from the left edge of the scrollport, as a valid length or a percentage.
auto
The offset is determind by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
| 初始值 |
auto
|
|---|---|
| 适用于 | scroll containers |
| 继承 | no |
| 百分比 | relative to the scroll container's scrollport |
| 计算值 | 如指定 |
| 动画类型 | by computed value type |
auto | <length-percentage>where
<length-percentage> = <length> | <percentage>
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Scroll Snap Module Level 1
The definition of 'scroll-padding-left' in that specification. |
候选推荐 | 初始定义 |
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
scroll-padding-left
|
Chrome 完整支持 69 | Edge 完整支持 79 | Firefox 完整支持 68 | IE 不支持 No | Opera 完整支持 56 |
Safari
部分支持
11
注意事项
|
WebView Android 完整支持 69 | Chrome Android 完整支持 69 | Firefox Android 完整支持 68 | Opera Android 完整支持 48 |
Safari iOS
部分支持
11
注意事项
|
Samsung Internet Android 完整支持 10.0 |
完整支持
部分支持
不支持
见实现注意事项。
scroll-margin
scroll-margin-block
scroll-margin-block-end
scroll-margin-block-start
scroll-margin-bottom
scroll-margin-inline
scroll-margin-inline-end
scroll-margin-inline-start
scroll-margin-left
scroll-margin-right
scroll-margin-top
scroll-padding
scroll-padding-block
scroll-padding-block-end
scroll-padding-block-start
scroll-padding-bottom
scroll-padding-inline
scroll-padding-inline-end
scroll-padding-inline-start
scroll-padding-left
scroll-padding-right
scroll-padding-top
scroll-snap-align
scroll-snap-coordinate
scroll-snap-destination
scroll-snap-points-x
scroll-snap-points-y
scroll-snap-stop
scroll-snap-type
scroll-snap-type-x
scroll-snap-type-y