---
title: scroll-padding-inline-end
slug: Web/CSS/scroll-padding-inline-end
---
{{CSSRef}}
**`scroll-padding-inline-end`** 属性定义了滚动口的*最优视区*——用于在用户视野中放置内容的目标区域——的行末内边距。作者由此得以排除滚动口被其他内容(如固定定位的工具栏或侧边栏)所遮挡的区域,或在目标元素与滚动口的边之间留出更多余地。
{{InteractiveExample("CSS Demo: scroll-padding-inline-end")}}
```css interactive-example-choice
scroll-padding-inline-end: 0;
```
```css interactive-example-choice
scroll-padding-inline-end: 20px;
```
```css interactive-example-choice
scroll-padding-inline-end: 2em;
```
```html interactive-example
```
```css interactive-example
.default-example {
flex-wrap: wrap;
}
.default-example .info {
width: 100%;
padding: 0.5em 0;
font-size: 90%;
}
.scroller {
text-align: left;
width: 250px;
height: 250px;
overflow-x: scroll;
display: flex;
box-sizing: border-box;
border: 1px solid black;
scroll-snap-type: x mandatory;
}
.scroller > div {
flex: 0 0 250px;
width: 250px;
background-color: rebeccapurple;
color: #fff;
font-size: 30px;
display: flex;
align-items: center;
justify-content: center;
scroll-snap-align: end;
}
.scroller > div:nth-child(even) {
background-color: #fff;
color: rebeccapurple;
}
```
## 语法
```css
/* 关键字值 */
scroll-padding-inline-end: auto;
/* 值 */
scroll-padding-inline-end: 10px;
scroll-padding-inline-end: 1em;
scroll-padding-inline-end: 10%;
/* 全局值 */
scroll-padding-inline-end: inherit;
scroll-padding-inline-end: initial;
scroll-padding-inline-end: revert;
scroll-padding-inline-end: revert-layer;
scroll-padding-inline-end: unset;
```
### 取值
- ``
- : 滚动口的行末内边距,为有效的长度或百分比。
- `auto`
- : 此内边距由用户代理所决定。此值通常为 `0px`,但用户代理可检测非零值是否更合理并另行处理。
## 形式定义
{{CSSInfo}}
## 形式语法
{{CSSSyntax}}
## 规范
{{Specifications}}
## 浏览器兼容性
{{Compat}}
## 参见
- [CSS 滚动吸附](/zh-CN/docs/Web/CSS/CSS_scroll_snap)
- [用 CSS 滚动吸附明确控制滚动](https://web.developers.google.cn/articles/css-scroll-snap)