From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/css/scroll-snap-coordinate/index.html | 156 +++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 files/ja/web/css/scroll-snap-coordinate/index.html (limited to 'files/ja/web/css/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 new file mode 100644 index 0000000000..45bac430de --- /dev/null +++ b/files/ja/web/css/scroll-snap-coordinate/index.html @@ -0,0 +1,156 @@ +--- +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")}}

-- cgit v1.2.3-54-g00ecf