1. 開発者向けのウェブ技術
  2. CSS: カスケーディングスタイルシート
  3. CSS リファレンス
  4. プロパティ
  5. scroll-padding-block-end

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

scroll-padding-block-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-block-end プロパティは、スクロールポートの最適表示領域のブロック方向における末尾側のオフセットを定義します。ユーザーのビュー内でものを配置するためのターゲット領域として使用される領域です。これにより、他のコンテンツ(固定位置のツールバーやサイドバーなど)によって隠されているスクロールポートの領域を除外したり、単にターゲット要素とスクロールポートの端との間により多くの余裕を持たせたりすることができます。

試してみましょう

scroll-padding-block-end: 0;
scroll-padding-block-end: 20px;
scroll-padding-block-end: 2em;
<section class="default-example" id="default-example">
 <div class="scroller" id="example-element">
 <div>1</div>
 <div>2</div>
 <div>3</div>
 </div>
 <div class="info">スクロール »</div>
</section>
.default-example .info {
 inline-size: 100%;
 padding: 0.5em 0;
 font-size: 90%;
 writing-mode: vertical-rl;
}
.scroller {
 text-align: left;
 height: 250px;
 width: 270px;
 overflow-y: scroll;
 display: flex;
 flex-direction: column;
 box-sizing: border-box;
 border: 1px solid black;
 scroll-snap-type: y mandatory;
}
.scroller > div {
 flex: 0 0 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-block-end: auto;
/* <length> 値 */
scroll-padding-block-end: 10px;
scroll-padding-block-end: 1em;
scroll-padding-block-end: 10%;
/* グローバル値 */
scroll-padding-block-end: inherit;
scroll-padding-block-end: initial;
scroll-padding-block-end: revert;
scroll-padding-block-end: revert-layer;
scroll-padding-block-end: unset;

<length-percentage>

スクロールポートのブロック方向の末尾側からの内側のオフセットで、有効な長さまたはパーセント値です。

auto

オフセットはユーザーエージェントが決定します。これは一般に 0px になりますが、ゼロ以外の値がもっと適切である場合をユーザーエージェントが検出して、他の値を採用することもできます。

公式定義

初期値 auto
適用対象スクロールコンテナー
継承 なし
パーセント値スクロールコンテナーのスクロールポートに対する相対値
計算値 指定通り
アニメーションの種類 計算値の型による

形式文法

scroll-padding-block-end = 
auto |
<length-percentage [0,∞]>

<length-percentage> =
<length> |
<percentage>

仕様書

Specification
CSS Scroll Snap Module Level 1
# padding-longhands-logical

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /