このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。
scroll-padding-inline-end
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年9月.
scroll-padding-inline-end プロパティは、スクロールポートの最適表示領域のインライン方向における末尾側のオフセットを定義します。ユーザーのビュー内でものを配置するためのターゲット領域として使用される領域です。これにより、他のコンテンツ(固定位置のツールバーやサイドバーなど)によって隠されているスクロールポートの領域を除外したり、単にターゲット要素とスクロールポートの端との間により多くの余裕を持たせたりすることができます。
In this article
試してみましょう
scroll-padding-inline-end: 0;scroll-padding-inline-end: 20px;scroll-padding-inline-end: 2em;<section> <div> <div>1</div> <div>2</div> <div>3</div> </div> <div>スクロール »</div></section>.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;/* <length> 値 */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;値
<length-percentage>スクロールポートのインライン方向の末尾側からの内側のオフセットで、有効な長さまたはパーセント値です。
autoオフセットはユーザーエージェントが決定します。これは一般に 0px になりますが、ゼロ以外の値がもっと適切である場合をユーザーエージェントが検出して、他の値を採用することもできます。
公式定義
| 初期値 | auto |
|---|---|
| 適用対象 | スクロールコンテナー |
| 継承 | なし |
| パーセント値 | スクロールコンテナーのスクロールポートに対する相対値 |
| 計算値 | 指定通り |
| アニメーションの種類 | 計算値の型による |
形式文法
scroll-padding-inline-end =
auto|
<length-percentage [0,∞]>
<length-percentage> =
<length>|
<percentage>
仕様書
| Specification |
|---|
| CSS Scroll Snap Module Level 1> # padding-longhands-logical> |