From ab39a23e5f2b5e5f533637cbb5a5d4af90bb00a9 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 10 Oct 2021 22:28:00 +0900 Subject: CSS スクロールスナップ点の文書を更新準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/css_scroll_snap_points/index.html | 59 ----- files/ja/web/css/css_scroll_snap_points/index.md | 59 +++++ files/ja/web/css/scroll-snap-coordinate/index.html | 154 ------------- files/ja/web/css/scroll-snap-coordinate/index.md | 154 +++++++++++++ .../ja/web/css/scroll-snap-destination/index.html | 146 ------------ files/ja/web/css/scroll-snap-destination/index.md | 146 ++++++++++++ files/ja/web/css/scroll-snap-type/index.html | 244 --------------------- files/ja/web/css/scroll-snap-type/index.md | 244 +++++++++++++++++++++ 8 files changed, 603 insertions(+), 603 deletions(-) delete mode 100644 files/ja/web/css/css_scroll_snap_points/index.html create mode 100644 files/ja/web/css/css_scroll_snap_points/index.md delete mode 100644 files/ja/web/css/scroll-snap-coordinate/index.html create mode 100644 files/ja/web/css/scroll-snap-coordinate/index.md delete mode 100644 files/ja/web/css/scroll-snap-destination/index.html create mode 100644 files/ja/web/css/scroll-snap-destination/index.md delete mode 100644 files/ja/web/css/scroll-snap-type/index.html create mode 100644 files/ja/web/css/scroll-snap-type/index.md (limited to 'files/ja/web/css') diff --git a/files/ja/web/css/css_scroll_snap_points/index.html b/files/ja/web/css/css_scroll_snap_points/index.html deleted file mode 100644 index 5b6996036e..0000000000 --- a/files/ja/web/css/css_scroll_snap_points/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: CSS スクロールスナップ点 -slug: Web/CSS/CSS_Scroll_Snap_Points -tags: - - CSS - - CSS スクロールスナップ点 - - Overview - - Reference - - 概要 -translation_of: Web/CSS/CSS_Scroll_Snap_Points ---- -
{{CSSRef}} {{deprecated_header}}
- -

CSS スクロールスナップ点 (CSS Scroll Snap Points) は CSS のモジュールの一つで、スクロールのスナップ位置を導入します。これは、スクロールの実行が終了した後にコンテナーのスクロール領域が停止する位置を明示的に決定します。

- -
-

メモ: CSS スクロールスナップがこの機能を定義する最新の仕様書です。

-
- -

リファレンス

- -

CSS プロパティ

- -
- -
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-points-y", "scroll-snap-points-y")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
- -

ブラウザーの対応

- -

scroll-snap-coordinate プロパティ

- -
-

{{Compat("css.properties.scroll-snap-coordinate")}}

-
diff --git a/files/ja/web/css/css_scroll_snap_points/index.md b/files/ja/web/css/css_scroll_snap_points/index.md new file mode 100644 index 0000000000..5b6996036e --- /dev/null +++ b/files/ja/web/css/css_scroll_snap_points/index.md @@ -0,0 +1,59 @@ +--- +title: CSS スクロールスナップ点 +slug: Web/CSS/CSS_Scroll_Snap_Points +tags: + - CSS + - CSS スクロールスナップ点 + - Overview + - Reference + - 概要 +translation_of: Web/CSS/CSS_Scroll_Snap_Points +--- +
{{CSSRef}} {{deprecated_header}}
+ +

CSS スクロールスナップ点 (CSS Scroll Snap Points) は CSS のモジュールの一つで、スクロールのスナップ位置を導入します。これは、スクロールの実行が終了した後にコンテナーのスクロール領域が停止する位置を明示的に決定します。

+ +
+

メモ: CSS スクロールスナップがこの機能を定義する最新の仕様書です。

+
+ +

リファレンス

+ +

CSS プロパティ

+ +
+ +
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-points-y", "scroll-snap-points-y")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
+ +

ブラウザーの対応

+ +

scroll-snap-coordinate プロパティ

+ +
+

{{Compat("css.properties.scroll-snap-coordinate")}}

+
diff --git a/files/ja/web/css/scroll-snap-coordinate/index.html b/files/ja/web/css/scroll-snap-coordinate/index.html deleted file mode 100644 index 1a9e185a3b..0000000000 --- a/files/ja/web/css/scroll-snap-coordinate/index.html +++ /dev/null @@ -1,154 +0,0 @@ ---- -title: scroll-snap-coordinate -slug: Web/CSS/scroll-snap-coordinate -tags: - - CSS - - CSS スクロールスナップ - - CSS プロパティ - - Deprecated - - Reference - - scroll-snap-coordinate -translation_of: Web/CSS/scroll-snap-coordinate ---- -
{{CSSRef}}{{deprecated_header}}
- -

CSSscroll-snap-coordinate プロパティは、このプロパティは、最も近い祖先のスクロールコンテナーの {{cssxref("scroll-snap-destination")}} に配置される要素内の X 座標と Y 座標の位置をそれぞれの軸で定義します。

- -
/* キーワード値 */
-scroll-snap-coordinate: none;
-
-/* <position> 値 */
-scroll-snap-coordinate: 50px 50px;                   /* 単一の座標 */
-scroll-snap-coordinate: 100px 100px, 100px bottom;   /* 複数の座標 */
-
-/* グローバル値 */
-scroll-snap-coordinate: inherit;
-scroll-snap-coordinate: initial;
-scroll-snap-coordinate: unset;
- -

要素が変形されていた場合は、スナップ座標はそのように変換されるので、スナップ点の配置は要素が表示された時に行われます。

- -
{{cssinfo}}
- -

構文

- -

- -
-
none
-
要素がスナップ点を提供しないことを示します。
-
{{cssxref("<position>")}}
-
スナップ座標を要素の境界ボックスの開始側の辺からのオフセットで示します。それぞれの組は、最初の値がスナップ座標の X 座標で、二番目の値は Y 座標です。
-
- -

形式文法

- -{{csssyntax}} - -

- -

HTML

- -
<div id="container">
-  <div>
-    <p>At coordinate (0, 0)</p>
-    <div class="scrollContainer coordinate0">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-
-  <div>
-    <p>At coordinate (25, 0)</p>
-    <div class="scrollContainer coordinate25">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-
-  <div>
-    <p>At coordinate (50, 0)</p>
-    <div class="scrollContainer coordinate50">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-</div>
-
- -

CSS

- -
#container {
-  display: flex;
-}
-
-#container > div:nth-child(-n+2) {
-  margin-right: 20px;
-}
-
-.scrollContainer {
-  width: 100px;
-  overflow: auto;
-  white-space: nowrap;
-  scroll-snap-type: mandatory;
-  font-size: 0;
-}
-
-.scrollContainer > div {
-  width: 100px;
-  height: 100px;
-  display: inline-block;
-  line-height: 100px;
-  text-align: center;
-  font-size: 50px;
-}
-
-.coordinate0 > div {
-  scroll-snap-coordinate: 0 0;
-}
-
-.coordinate25 > div {
-  scroll-snap-coordinate: 25px 0;
-}
-
-.coordinate50 > div {
-  scroll-snap-coordinate: 50px 0;
-}
-
-.scrollContainer > div:nth-child(even) {
-  background-color: #87ea87;
-}
-
-.scrollContainer > div:nth-child(odd) {
-  background-color: #87ccea;
-}
- -

Result

- -

{{EmbedLiveSample("Example", "100%", "170")}}

- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-coordinate", "scroll-snap-coordinate")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
- -

ブラウザーの対応

- -

{{Compat("css.properties.scroll-snap-coordinate")}}

diff --git a/files/ja/web/css/scroll-snap-coordinate/index.md b/files/ja/web/css/scroll-snap-coordinate/index.md new file mode 100644 index 0000000000..1a9e185a3b --- /dev/null +++ b/files/ja/web/css/scroll-snap-coordinate/index.md @@ -0,0 +1,154 @@ +--- +title: scroll-snap-coordinate +slug: Web/CSS/scroll-snap-coordinate +tags: + - CSS + - CSS スクロールスナップ + - CSS プロパティ + - Deprecated + - Reference + - scroll-snap-coordinate +translation_of: Web/CSS/scroll-snap-coordinate +--- +
{{CSSRef}}{{deprecated_header}}
+ +

CSSscroll-snap-coordinate プロパティは、このプロパティは、最も近い祖先のスクロールコンテナーの {{cssxref("scroll-snap-destination")}} に配置される要素内の X 座標と Y 座標の位置をそれぞれの軸で定義します。

+ +
/* キーワード値 */
+scroll-snap-coordinate: none;
+
+/* <position> 値 */
+scroll-snap-coordinate: 50px 50px;                   /* 単一の座標 */
+scroll-snap-coordinate: 100px 100px, 100px bottom;   /* 複数の座標 */
+
+/* グローバル値 */
+scroll-snap-coordinate: inherit;
+scroll-snap-coordinate: initial;
+scroll-snap-coordinate: unset;
+ +

要素が変形されていた場合は、スナップ座標はそのように変換されるので、スナップ点の配置は要素が表示された時に行われます。

+ +
{{cssinfo}}
+ +

構文

+ +

+ +
+
none
+
要素がスナップ点を提供しないことを示します。
+
{{cssxref("<position>")}}
+
スナップ座標を要素の境界ボックスの開始側の辺からのオフセットで示します。それぞれの組は、最初の値がスナップ座標の X 座標で、二番目の値は Y 座標です。
+
+ +

形式文法

+ +{{csssyntax}} + +

+ +

HTML

+ +
<div id="container">
+  <div>
+    <p>At coordinate (0, 0)</p>
+    <div class="scrollContainer coordinate0">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+
+  <div>
+    <p>At coordinate (25, 0)</p>
+    <div class="scrollContainer coordinate25">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+
+  <div>
+    <p>At coordinate (50, 0)</p>
+    <div class="scrollContainer coordinate50">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+</div>
+
+ +

CSS

+ +
#container {
+  display: flex;
+}
+
+#container > div:nth-child(-n+2) {
+  margin-right: 20px;
+}
+
+.scrollContainer {
+  width: 100px;
+  overflow: auto;
+  white-space: nowrap;
+  scroll-snap-type: mandatory;
+  font-size: 0;
+}
+
+.scrollContainer > div {
+  width: 100px;
+  height: 100px;
+  display: inline-block;
+  line-height: 100px;
+  text-align: center;
+  font-size: 50px;
+}
+
+.coordinate0 > div {
+  scroll-snap-coordinate: 0 0;
+}
+
+.coordinate25 > div {
+  scroll-snap-coordinate: 25px 0;
+}
+
+.coordinate50 > div {
+  scroll-snap-coordinate: 50px 0;
+}
+
+.scrollContainer > div:nth-child(even) {
+  background-color: #87ea87;
+}
+
+.scrollContainer > div:nth-child(odd) {
+  background-color: #87ccea;
+}
+ +

Result

+ +

{{EmbedLiveSample("Example", "100%", "170")}}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-coordinate", "scroll-snap-coordinate")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
+ +

ブラウザーの対応

+ +

{{Compat("css.properties.scroll-snap-coordinate")}}

diff --git a/files/ja/web/css/scroll-snap-destination/index.html b/files/ja/web/css/scroll-snap-destination/index.html deleted file mode 100644 index 98b8ccb23f..0000000000 --- a/files/ja/web/css/scroll-snap-destination/index.html +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: scroll-snap-destination -slug: Web/CSS/scroll-snap-destination -tags: - - CSS - - CSS スクロールスナップ - - CSS プロパティ - - Deprecated - - Reference -translation_of: Web/CSS/scroll-snap-destination ---- -
{{CSSRef}}{{deprecated_header}}
- -

CSSscroll-snap-destination プロパティは、スクロールコンテナーの視覚的な{{Glossary("viewport", "ビューポート")}}内の要素のスナップポイントが配置される X および Y 座標の位置を定義します。

- -
/* <position> 値 */
-scroll-snap-destination: 400px 600px;
-
-/* グローバル値 */
-scroll-snap-destination: inherit;
-scroll-snap-destination: initial;
-scroll-snap-destination: unset;
-
- -

{{cssinfo}}

- -

構文

- -

- -
-
<position>
-
スクロールコンテナーの視覚的なビューポートの先頭側の端からのスナップ距離のオフセットを指定します。最初の値はスナップ距離の X 座標、二番目の値は Y 座標です。
-
- -

形式文法

- -{{csssyntax}} - -

- -

HTML

- -
<div id="container">
-  <div>
-    <p>At coordinate (0, 0)</p>
-    <div class="scrollContainer destination0">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-
-  <div>
-    <p>At coordinate (25, 0)</p>
-    <div class="scrollContainer destination25">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-
-  <div>
-    <p>At coordinate (50, 0)</p>
-    <div class="scrollContainer destination50">
-      <div>1</div>
-      <div>2</div>
-      <div>3</div>
-    </div>
-  </div>
-</div>
-
- -

CSS

- -
#container {
-  display: flex;
-}
-
-#container > div:nth-child(-n+2) {
-  margin-right: 20px;
-}
-
-.scrollContainer {
-  width: 100px;
-  overflow: auto;
-  white-space: nowrap;
-  scroll-snap-points-x: repeat(100%);
-  scroll-snap-type: mandatory;
-  scroll-snap-destination: 20px 0;
-  font-size: 0;
-}
-
-.destination0 {
-  scroll-snap-destination: 0 0;
-}
-
-.destination25 {
-  scroll-snap-destination: 25px 0;
-}
-
-.destination50 {
-  scroll-snap-destination: 50px 0;
-}
-
-.scrollContainer > div {
-  width: 100px;
-  height: 100px;
-  display: inline-block;
-  line-height: 100px;
-  text-align: center;
-  font-size: 50px;
-}
-
-.scrollContainer > div:nth-child(even) {
-  background-color: #87EA87;
-}
-
-.scrollContainer > div:nth-child(odd) {
-  background-color: #87CCEA;
-}
- -
{{EmbedLiveSample("Example", "100%", "170")}}
- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-destination", "scroll-snap-destination")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
- -

ブラウザーの対応

- -
{{Compat("css.properties.scroll-snap-destination")}}
diff --git a/files/ja/web/css/scroll-snap-destination/index.md b/files/ja/web/css/scroll-snap-destination/index.md new file mode 100644 index 0000000000..98b8ccb23f --- /dev/null +++ b/files/ja/web/css/scroll-snap-destination/index.md @@ -0,0 +1,146 @@ +--- +title: scroll-snap-destination +slug: Web/CSS/scroll-snap-destination +tags: + - CSS + - CSS スクロールスナップ + - CSS プロパティ + - Deprecated + - Reference +translation_of: Web/CSS/scroll-snap-destination +--- +
{{CSSRef}}{{deprecated_header}}
+ +

CSSscroll-snap-destination プロパティは、スクロールコンテナーの視覚的な{{Glossary("viewport", "ビューポート")}}内の要素のスナップポイントが配置される X および Y 座標の位置を定義します。

+ +
/* <position> 値 */
+scroll-snap-destination: 400px 600px;
+
+/* グローバル値 */
+scroll-snap-destination: inherit;
+scroll-snap-destination: initial;
+scroll-snap-destination: unset;
+
+ +

{{cssinfo}}

+ +

構文

+ +

+ +
+
<position>
+
スクロールコンテナーの視覚的なビューポートの先頭側の端からのスナップ距離のオフセットを指定します。最初の値はスナップ距離の X 座標、二番目の値は Y 座標です。
+
+ +

形式文法

+ +{{csssyntax}} + +

+ +

HTML

+ +
<div id="container">
+  <div>
+    <p>At coordinate (0, 0)</p>
+    <div class="scrollContainer destination0">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+
+  <div>
+    <p>At coordinate (25, 0)</p>
+    <div class="scrollContainer destination25">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+
+  <div>
+    <p>At coordinate (50, 0)</p>
+    <div class="scrollContainer destination50">
+      <div>1</div>
+      <div>2</div>
+      <div>3</div>
+    </div>
+  </div>
+</div>
+
+ +

CSS

+ +
#container {
+  display: flex;
+}
+
+#container > div:nth-child(-n+2) {
+  margin-right: 20px;
+}
+
+.scrollContainer {
+  width: 100px;
+  overflow: auto;
+  white-space: nowrap;
+  scroll-snap-points-x: repeat(100%);
+  scroll-snap-type: mandatory;
+  scroll-snap-destination: 20px 0;
+  font-size: 0;
+}
+
+.destination0 {
+  scroll-snap-destination: 0 0;
+}
+
+.destination25 {
+  scroll-snap-destination: 25px 0;
+}
+
+.destination50 {
+  scroll-snap-destination: 50px 0;
+}
+
+.scrollContainer > div {
+  width: 100px;
+  height: 100px;
+  display: inline-block;
+  line-height: 100px;
+  text-align: center;
+  font-size: 50px;
+}
+
+.scrollContainer > div:nth-child(even) {
+  background-color: #87EA87;
+}
+
+.scrollContainer > div:nth-child(odd) {
+  background-color: #87CCEA;
+}
+ +
{{EmbedLiveSample("Example", "100%", "170")}}
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-destination", "scroll-snap-destination")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
+ +

ブラウザーの対応

+ +
{{Compat("css.properties.scroll-snap-destination")}}
diff --git a/files/ja/web/css/scroll-snap-type/index.html b/files/ja/web/css/scroll-snap-type/index.html deleted file mode 100644 index b80fe7bda1..0000000000 --- a/files/ja/web/css/scroll-snap-type/index.html +++ /dev/null @@ -1,244 +0,0 @@ ---- -title: scroll-snap-type -slug: Web/CSS/scroll-snap-type -tags: - - CSS - - CSS スクロールスナップ - - CSS プロパティ - - Reference -translation_of: Web/CSS/scroll-snap-type ---- -
{{CSSRef}}
- -

scroll-snap-typeCSS のプロパティで、スナップ点が存在する場合にスクロールコンテナーにどれだけ厳密にスナップ点を強制するかを設定します。

- -

スナップ点へ強制するために使用する詳細なアニメーションや力学の指定はこのプロパティでは扱わず、代わりにユーザーエージェントに委ねられます。

- -
/* キーワード値 */
-scroll-snap-type: none;
-scroll-snap-type: x;
-scroll-snap-type: y;
-scroll-snap-type: block;
-scroll-snap-type: inline;
-scroll-snap-type: both;
-
-/* 任意の mandatory | proximity*/
-scroll-snap-type: x mandatory;
-scroll-snap-type: y proximity;
-scroll-snap-type: both mandatory;
-
-/* など */
-
-/* グローバル値 */
-scroll-snap-type: inherit;
-scroll-snap-type: initial;
-scroll-snap-type: unset;
-
- -

{{cssinfo}}

- -

構文

- -

- -
-
none
-
このスクロールコンテナーの視覚的な{{Glossary("viewport", "ビューポート")}}がスクロールする時は、スナップ点を無視しなければなりません。
-
x
-
スクロールコンテナーは水平軸のみで、スナップ位置に合わせられます。
-
y
-
スクロールコンテナーは垂直軸のみで、スナップ位置に合わせられます。
-
block
-
スクロールコンテナーはブロック軸のみで、スナップ位置に合わせられます。
-
inline
-
スクロールコンテナーはインライン軸のみで、スナップ位置に合わせられます。
-
both
-
スクロールコンテナーは両方の軸で、個別にスナップ位置に合わせられます (それぞれの軸で異なる要素に位置が合わせられる可能性があります)。
-
mandatory
-
このスクロールコンテナーの視覚的なビューポートは、現在スクロール中でなければスナップ点に合わせられます。これはスクロールアクションが終了した際に、可能であればその点にはまるということを意味しています。内容が追加、移動、削除、リサイズされた場合、スクロール量のオフセットは、そのスナップ点に載り続けるよう調整されます。
-
proximity
-
このスクロールコンテナーの視覚的なビューポートは、現在スクロール中でなければ、ユーザーエージェントのスクロール引数を考慮しつつスナップ点に載るよう動作する可能性があります。コンテンツが追加、移動、削除、リサイズされた場合、スクロール量のオフセットは、そのスナップ点に載り続けるよう調整されることがあります。
-
- -

形式文法

- -{{csssyntax}} - -

- -

HTML コンテンツ

- -
<div class="holster">
-<div class="container x mandatory-scroll-snapping" dir="ltr">
-  <div>X Mand. LTR</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container x proximity-scroll-snapping" dir="ltr">
-  <div>X Prox. LTR</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container y mandatory-scroll-snapping" dir="ltr">
-  <div>Y Mand. LTR</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container y proximity-scroll-snapping" dir="ltr">
-  <div>Y Prox. LTR</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container x mandatory-scroll-snapping" dir="rtl">
-  <div>X Mand. RTL</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container x proximity-scroll-snapping" dir="rtl">
-  <div>X Prox. RTL</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container y mandatory-scroll-snapping" dir="rtl">
-  <div>Y Mand. RTL</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-
-<div class="container y proximity-scroll-snapping" dir="rtl">
-  <div>Y Prox. RTL</div>
-  <div>2</div>
-  <div>3</div>
-  <div>4</div>
-  <div>5</div>
-</div>
-</div>
-
- -

CSS コンテンツ

- -
/* setup */
-html, body, .holster {
-  height: 100%;
-}
-.holster {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  flex-flow: column nowrap;
-  font-family: monospace;
-}
-
-.container {
-  display: flex;
-  overflow: auto;
-  outline: 1px dashed lightgray;
-  flex: none;
-}
-
-.container.x {
-  width: 100%;
-  height: 128px;
-  flex-flow: row nowrap;
-}
-
-.container.y {
-  width: 256px;
-  height: 256px;
-  flex-flow: column nowrap;
-}
-/* scroll-snap */
-.x.mandatory-scroll-snapping {
-  scroll-snap-type: x mandatory;
-}
-
-.y.mandatory-scroll-snapping {
-  scroll-snap-type: y mandatory;
-}
-
-.x.proximity-scroll-snapping {
-  scroll-snap-type: x proximity;
-}
-
-.y.proximity-scroll-snapping {
-  scroll-snap-type: y proximity;
-}
-
-.container > div {
-  text-align: center;
-  scroll-snap-align: center;
-  flex: none;
-}
-
-.x.container > div {
-  line-height: 128px;
-  font-size: 64px;
-  width: 100%;
-  height: 128px;
-}
-
-.y.container > div {
-  line-height: 256px;
-  font-size: 128px;
-  width: 256px;
-  height: 100%;
-}
-/* appearance fixes */
-.y.container > div:first-child {
-  line-height: 1.3;
-  font-size: 64px;
-}
-/* coloration */
-.container > div:nth-child(even) {
-  background-color: #87EA87;
-}
-
-.container > div:nth-child(odd) {
-  background-color: #87CCEA;
-}
-
- -

{{EmbedLiveSample("Example", "100%", "1630")}}

- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-type", "scroll-snap-type")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
- -

ブラウザーの対応

- -

{{Compat("css.properties.scroll-snap-type")}}

diff --git a/files/ja/web/css/scroll-snap-type/index.md b/files/ja/web/css/scroll-snap-type/index.md new file mode 100644 index 0000000000..b80fe7bda1 --- /dev/null +++ b/files/ja/web/css/scroll-snap-type/index.md @@ -0,0 +1,244 @@ +--- +title: scroll-snap-type +slug: Web/CSS/scroll-snap-type +tags: + - CSS + - CSS スクロールスナップ + - CSS プロパティ + - Reference +translation_of: Web/CSS/scroll-snap-type +--- +
{{CSSRef}}
+ +

scroll-snap-typeCSS のプロパティで、スナップ点が存在する場合にスクロールコンテナーにどれだけ厳密にスナップ点を強制するかを設定します。

+ +

スナップ点へ強制するために使用する詳細なアニメーションや力学の指定はこのプロパティでは扱わず、代わりにユーザーエージェントに委ねられます。

+ +
/* キーワード値 */
+scroll-snap-type: none;
+scroll-snap-type: x;
+scroll-snap-type: y;
+scroll-snap-type: block;
+scroll-snap-type: inline;
+scroll-snap-type: both;
+
+/* 任意の mandatory | proximity*/
+scroll-snap-type: x mandatory;
+scroll-snap-type: y proximity;
+scroll-snap-type: both mandatory;
+
+/* など */
+
+/* グローバル値 */
+scroll-snap-type: inherit;
+scroll-snap-type: initial;
+scroll-snap-type: unset;
+
+ +

{{cssinfo}}

+ +

構文

+ +

+ +
+
none
+
このスクロールコンテナーの視覚的な{{Glossary("viewport", "ビューポート")}}がスクロールする時は、スナップ点を無視しなければなりません。
+
x
+
スクロールコンテナーは水平軸のみで、スナップ位置に合わせられます。
+
y
+
スクロールコンテナーは垂直軸のみで、スナップ位置に合わせられます。
+
block
+
スクロールコンテナーはブロック軸のみで、スナップ位置に合わせられます。
+
inline
+
スクロールコンテナーはインライン軸のみで、スナップ位置に合わせられます。
+
both
+
スクロールコンテナーは両方の軸で、個別にスナップ位置に合わせられます (それぞれの軸で異なる要素に位置が合わせられる可能性があります)。
+
mandatory
+
このスクロールコンテナーの視覚的なビューポートは、現在スクロール中でなければスナップ点に合わせられます。これはスクロールアクションが終了した際に、可能であればその点にはまるということを意味しています。内容が追加、移動、削除、リサイズされた場合、スクロール量のオフセットは、そのスナップ点に載り続けるよう調整されます。
+
proximity
+
このスクロールコンテナーの視覚的なビューポートは、現在スクロール中でなければ、ユーザーエージェントのスクロール引数を考慮しつつスナップ点に載るよう動作する可能性があります。コンテンツが追加、移動、削除、リサイズされた場合、スクロール量のオフセットは、そのスナップ点に載り続けるよう調整されることがあります。
+
+ +

形式文法

+ +{{csssyntax}} + +

+ +

HTML コンテンツ

+ +
<div class="holster">
+<div class="container x mandatory-scroll-snapping" dir="ltr">
+  <div>X Mand. LTR</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container x proximity-scroll-snapping" dir="ltr">
+  <div>X Prox. LTR</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container y mandatory-scroll-snapping" dir="ltr">
+  <div>Y Mand. LTR</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container y proximity-scroll-snapping" dir="ltr">
+  <div>Y Prox. LTR</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container x mandatory-scroll-snapping" dir="rtl">
+  <div>X Mand. RTL</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container x proximity-scroll-snapping" dir="rtl">
+  <div>X Prox. RTL</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container y mandatory-scroll-snapping" dir="rtl">
+  <div>Y Mand. RTL</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+
+<div class="container y proximity-scroll-snapping" dir="rtl">
+  <div>Y Prox. RTL</div>
+  <div>2</div>
+  <div>3</div>
+  <div>4</div>
+  <div>5</div>
+</div>
+</div>
+
+ +

CSS コンテンツ

+ +
/* setup */
+html, body, .holster {
+  height: 100%;
+}
+.holster {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  flex-flow: column nowrap;
+  font-family: monospace;
+}
+
+.container {
+  display: flex;
+  overflow: auto;
+  outline: 1px dashed lightgray;
+  flex: none;
+}
+
+.container.x {
+  width: 100%;
+  height: 128px;
+  flex-flow: row nowrap;
+}
+
+.container.y {
+  width: 256px;
+  height: 256px;
+  flex-flow: column nowrap;
+}
+/* scroll-snap */
+.x.mandatory-scroll-snapping {
+  scroll-snap-type: x mandatory;
+}
+
+.y.mandatory-scroll-snapping {
+  scroll-snap-type: y mandatory;
+}
+
+.x.proximity-scroll-snapping {
+  scroll-snap-type: x proximity;
+}
+
+.y.proximity-scroll-snapping {
+  scroll-snap-type: y proximity;
+}
+
+.container > div {
+  text-align: center;
+  scroll-snap-align: center;
+  flex: none;
+}
+
+.x.container > div {
+  line-height: 128px;
+  font-size: 64px;
+  width: 100%;
+  height: 128px;
+}
+
+.y.container > div {
+  line-height: 256px;
+  font-size: 128px;
+  width: 256px;
+  height: 100%;
+}
+/* appearance fixes */
+.y.container > div:first-child {
+  line-height: 1.3;
+  font-size: 64px;
+}
+/* coloration */
+.container > div:nth-child(even) {
+  background-color: #87EA87;
+}
+
+.container > div:nth-child(odd) {
+  background-color: #87CCEA;
+}
+
+ +

{{EmbedLiveSample("Example", "100%", "1630")}}

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-snap-type", "scroll-snap-type")}}{{Spec2("CSS Scroll Snap Points")}}初回定義
+ +

ブラウザーの対応

+ +

{{Compat("css.properties.scroll-snap-type")}}

-- cgit v1.2.3-54-g00ecf