From c37331cf01367b94bdbcedc92abf516b34809c5c Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 10 Oct 2021 23:16:11 +0900 Subject: CSS スクロールスナップ点関係の文書を更新 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 2021/10/09 時点の英語版に基づき更新 --- files/ja/web/css/scroll-snap-destination/index.md | 162 +++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) (limited to 'files/ja/web/css/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 index 98b8ccb23f..6bb7353adf 100644 --- a/files/ja/web/css/scroll-snap-destination/index.md +++ b/files/ja/web/css/scroll-snap-destination/index.md @@ -3,81 +3,88 @@ title: scroll-snap-destination slug: Web/CSS/scroll-snap-destination tags: - CSS - - CSS スクロールスナップ - CSS プロパティ - - Deprecated + - CSS スクロールスナップ + - 非推奨 - Reference + - recipe:css-property +browser-compat: css.properties.scroll-snap-destination translation_of: Web/CSS/scroll-snap-destination --- -
{{CSSRef}}{{deprecated_header}}
+{{CSSRef}}{{deprecated_header}} -

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

+**`scroll-snap-destination`** は [CSS](/ja/docs/Web/CSS) のプロパティで、スクロールコンテナーの視覚{{Glossary("viewport", "ビューポート")}}内の要素のスナップ点が配置される X および Y 座標の位置を定義します。 -
/* <position> 値 */
+```css
+/*  値 */
 scroll-snap-destination: 400px 600px;
 
 /* グローバル値 */
 scroll-snap-destination: inherit;
 scroll-snap-destination: initial;
 scroll-snap-destination: unset;
-
+``` + +## 構文 -

{{cssinfo}}

+### 値 -

構文

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

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

形式文法

+## 形式文法 {{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 {
+## 例
+
+

スクロールスナップの宛先を設定

+ +#### HTML + +```html +
+
+

At coordinate (0, 0)

+
+  
1
+  
2
+  
3
+
+
+ +
+

At coordinate (25, 0)

+
+  
1
+  
2
+  
3
+
+
+ +
+

At coordinate (50, 0)

+
+  
1
+  
2
+  
3
+
+
+
+``` + +#### CSS + +```css +#container { display: flex; } -#container > div:nth-child(-n+2) { +#container > div:nth-child(-n+2) { margin-right: 20px; } @@ -103,7 +110,7 @@ scroll-snap-destination: unset; scroll-snap-destination: 50px 0; } -.scrollContainer > div { +.scrollContainer > div { width: 100px; height: 100px; display: inline-block; @@ -112,35 +119,28 @@ scroll-snap-destination: unset; font-size: 50px; } -.scrollContainer > div:nth-child(even) { +.scrollContainer > div:nth-child(even) { background-color: #87EA87; } -.scrollContainer > div:nth-child(odd) { +.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")}}
+} +``` + +#### 結果 + +{{EmbedLiveSample("Setting_scroll_snap_destination", "100%", "170")}} + +## 仕様書 + +どの標準にも含まれていません。 + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- [CSS スクロールスナップ](/ja/docs/Web/CSS/CSS_Scroll_Snap) +- [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/) -- cgit v1.2.3-54-g00ecf