overflow-anchor
CSS
property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts.
Scroll anchoring behavior is enabled by default in any browser that supports it. Therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off.
/* Keyword values */ overflow-anchor: auto; overflow-anchor: none; /* Global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset;
auto
The element becomes a potential anchor when adjusting scroll position.
none
The element won't be selected as a potential anchor.
| 初始值 |
auto
|
|---|---|
| 适用于 | 所有元素 |
| 继承 | no |
| 计算值 | 如指定 |
| 动画类型 | discrete |
auto | none
To prevent scroll anchoring in a document, use the
overflow-anchor
特性。
* {
overflow-anchor: none;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Scroll Anchoring Module Level 1
The definition of 'overflow-anchor' in that specification. |
编者草案 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
overflow-anchor
|
Chrome 完整支持 56 | Edge 完整支持 79 | Firefox 完整支持 66 | IE 不支持 No | Opera 完整支持 43 | Safari 不支持 No | WebView Android 完整支持 56 | Chrome Android 完整支持 56 | Firefox Android 不支持 No | Opera Android 完整支持 43 | Safari iOS 不支持 No | Samsung Internet Android 完整支持 6.0 |
完整支持
不支持
overflow-anchor