-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
68 lines (45 loc) · 2.02 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: scroll-padding-inline
slug: Web/CSS/scroll-padding-inline
page-type: css-shorthand-property
browser-compat: css.properties.scroll-padding-inline
---
{{CSSRef}}
The `scroll-padding-inline` [shorthand property](/en-US/docs/Web/CSS/Shorthand_properties) sets the scroll padding of an element in the inline dimension.
{{EmbedInteractiveExample("pages/css/scroll-padding-inline.html")}}
The scroll-padding properties define offsets for 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 to put more breathing room between a targeted element and the edges of the scrollport.
## Constituent properties
This property is a shorthand for the following CSS properties:
- [`scroll-padding-inline-end`](/en-US/docs/Web/CSS/scroll-padding-inline-end)
- [`scroll-padding-inline-start`](/en-US/docs/Web/CSS/scroll-padding-inline-start)
## Syntax
```css
/* Keyword values */
scroll-padding-inline: auto;
/* <length> values */
scroll-padding-inline: 10px;
scroll-padding-inline: 1em 0.5em;
scroll-padding-inline: 10%;
/* Global values */
scroll-padding-inline: inherit;
scroll-padding-inline: initial;
scroll-padding-inline: revert;
scroll-padding-inline: revert-layer;
scroll-padding-inline: unset;
```
### Values
- `<length-percentage>`
- : An inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.
- `auto`
- : The offset is determined 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.
## Formal definition
{{cssinfo}}
## Formal syntax
{{csssyntax}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [CSS scroll snap](/en-US/docs/Web/CSS/CSS_scroll_snap)
- [Well-controlled scrolling with CSS scroll snap](https://web.dev/articles/css-scroll-snap)