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/clip-path/index.html | 623 ++++++++++++++++++++++++++++++++++ 1 file changed, 623 insertions(+) create mode 100644 files/ja/web/css/clip-path/index.html (limited to 'files/ja/web/css/clip-path/index.html') diff --git a/files/ja/web/css/clip-path/index.html b/files/ja/web/css/clip-path/index.html new file mode 100644 index 0000000000..c469fec575 --- /dev/null +++ b/files/ja/web/css/clip-path/index.html @@ -0,0 +1,623 @@ +--- +title: clip-path +slug: Web/CSS/clip-path +tags: + - CSS + - CSS Masking + - CSS Property + - Experimental + - Reference + - Web + - 'recipe:css-property' +translation_of: Web/CSS/clip-path +--- +
{{CSSRef}}
+ +

clip-pathCSS のプロパティで、要素のどの部分を表示するかを設定するクリッピング領域を作ります。具体的には、領域の内部の部分は表示され、外側の部分は非表示になります。

+ +
{{EmbedInteractiveExample("pages/css/clip-path.html")}}
+ + + +

構文

+ +
/* キーワード値 */
+clip-path: none;
+
+/* <clip-source> 値 */
+clip-path: url(resources.svg#c1);
+
+/* <geometry-box> 値 */
+clip-path: margin-box;
+clip-path: border-box;
+clip-path: padding-box;
+clip-path: content-box;
+clip-path: fill-box;
+clip-path: stroke-box;
+clip-path: view-box;
+
+/* <basic-shape> 値 */
+clip-path: inset(100px 50px);
+clip-path: circle(50px at 0 100px);
+clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
+clip-path: path('M0.5,1 C0.5,1,0,0.7,0,0.3 A0.25,0.25,1,1,1,0.5,0.3 A0.25,0.25,1,1,1,1,0.3 C1,0.7,0.5,1,0.5,1 Z');
+
+/* ボックスおよびシェイプ値の組み合わせ */
+clip-path: padding-box circle(50px at 0 100px);
+
+/* グローバル値 */
+clip-path: inherit;
+clip-path: initial;
+clip-path: unset;
+
+ +

clip-path プロパティは、以下に挙げた値のうちの一つまたは組み合わせで指定します。

+ +

+ +
+
<clip-source>
+
SVG の {{SVGElement("clipPath")}} 要素を参照する {{cssxref("<url>")}} です。
+
{{cssxref("<basic-shape>")}}
+
<geometry-box> 値で寸法と位置が定義されるシェイプです。ジオメトリボックスが指定されない場合、参照ボックスとして border-box が使用されます。
+
<geometry-box>
+
<basic-shape> と共に指定された場合、この値は基本シェイプの参照ボックスを定義します。単独で指定された場合、指定のボックスの辺を、角の形 ({{cssxref("border-radius")}} など) を含めてクリッピングパスにします。ジオメトリボックスは以下の値のうちの一つが指定できます。
+
+
+
margin-box
+
マージンボックスを参照ボックスとして使用します。
+
border-box
+
境界ボックスを参照ボックスとして使用します。
+
padding-box
+
パディングボックスを参照ボックスとして使用します。
+
content-box
+
コンテンボックスを参照ボックスとして使用します。
+
fill-box
+
オブジェクトの境界ボックスを参照ボックスとして使用します。
+
stroke-box
+
ストロークの境界ボックスを参照ボックスとして使用します。
+
view-box
+
最も近い SVG のビューポートを参照ボックスとして使用します。 SVG のビューポートを作成する要素に {{SVGAttr("viewBox")}} 属性が指定されている場合、参照ボックスは viewBox 属性で指定された座標系の原点に位置し、参照ボックスの寸法は viewBox 属性の width および height 値に設定されます。
+
+
+
none
+
クリッピングパスは作成されません。
+
+ +
+

: 計算値が none 以外の場合は、新しい重ね合わせコンテキストを生成します。これは、 {{cssxref("opacity")}} が 1 以外の値の場合と同様です。

+
+ +

公式定義

+ +

{{cssinfo}}

+ +

形式文法

+ +
{{csssyntax}}
+ +

+ +

HTML と SVG の比較

+ + + +

{{EmbedLiveSample("Comparison_of_HTML_and_SVG", "100%", 800, "", "", "example-outcome-frame")}}

+ +

完全な例

+ +

HTML

+ +
<img id="clipped" src="https://mdn.mozillademos.org/files/12668/MDN.svg"
+    alt="MDN logo">
+<svg height="0" width="0">
+  <defs>
+    <clipPath id="cross">
+      <rect y="110" x="137" width="90" height="90"/>
+      <rect x="0" y="110" width="90" height="90"/>
+      <rect x="137" y="0" width="90" height="90"/>
+      <rect x="0" y="0" width="90" height="90"/>
+    </clipPath>
+  </defs>
+</svg>
+
+<select id="clipPath">
+  <option value="none">none</option>
+  <option value="circle(100px at 110px 100px)">circle</option>
+  <option value="url(#cross)" selected>cross</option>
+  <option value="inset(20px round 20px)">inset</option>
+  <option value="path('M 0 200 L 0,110 A 110,90 0,0,1 240,100 L 200 340 z')">path</option>
+</select>
+
+ +

CSS

+ +
#clipped {
+  margin-bottom: 20px;
+  clip-path: url(#cross);
+}
+
+ + + +

結果

+ +

{{EmbedLiveSample("Complete_example", 230, 250)}}

+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("CSS Shapes 2", "#supported-basic-shapes", 'path')}}{{Spec2('CSS Shapes 2')}}path() を定義。
{{SpecName("CSS Masks", "#the-clip-path", 'clip-path')}}{{Spec2('CSS Masks')}}適用範囲を HTML 要素に拡張。 clip-path プロパティが非推奨の {{cssxref("clip")}} プロパティを置き換えた。
{{SpecName('SVG1.1', 'masking.html#ClipPathProperty', 'clip-path')}}{{Spec2('SVG1.1')}}初回定義 (SVG 要素のみに適用)。
+ +

ブラウザーの互換性

+ + + +

{{Compat("css.properties.clip-path")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf