diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/svg/attribute/clip-path/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/svg/attribute/clip-path/index.html')
-rw-r--r-- | files/zh-cn/web/svg/attribute/clip-path/index.html | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/files/zh-cn/web/svg/attribute/clip-path/index.html b/files/zh-cn/web/svg/attribute/clip-path/index.html new file mode 100644 index 0000000000..c05dcf75d4 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/clip-path/index.html @@ -0,0 +1,111 @@ +--- +title: clip-path +slug: Web/SVG/Attribute/clip-path +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/clip-path +--- +<div>{{SVGRef}}</div> + +<p>元素的表现属性 <strong><code>clip-path</code></strong> 为其定义或关联一条剪切路径。</p> + +<p class="note"><strong>注意:</strong><code>clip-path</code> 是一个表现属性,可以作为 CSS 属性使用。</p> + +<p>作为一种表现属性,<code>clip-path</code> 可以用于任何元素,不过效果最明显的是下列十九种元素:{{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('ellipse')}}, {{SVGElement('g')}}, {{SVGElement('glyph')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}}, {{SVGElement('use')}}</p> + +<div id="topExample"> +<div class="hidden"> +<pre class="brush: css">html,body,svg { height:100% }</pre> +</div> + +<pre class="brush: html"><svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> + <clipPath id="myClip" clipPathUnits="objectBoundingBox"> + <circle cx=".5" cy=".5" r=".5" /> + </clipPath> + + <!-- 左上:应用自定义的剪切路径 --> + <rect x="1" y="1" width="8" height="8" stroke="green" + clip-path="url(#myClip)" /> + + <!-- 右上:应用 CSS 基本形状和 fill-box 几何。 + 实质上和自定义剪切路径并把 clipPathUnits + 设成 objectBoundingBox 一样 --> + <rect x="11" y="1" width="8" height="8" stroke="green" + clip-path="circle() fill-box" /> + + <!-- 左下 --> + <rect x="1" y="11" width="8" height="8" stroke="green" + clip-path="circle() stroke-box" /> + + <!-- 右下:应用CSS基本形状和 view-box 几何。 + 实质上和自定义剪切路径并把 clipPathUnits + 设成 userSpaceOnUse 一样 --> + <rect x="11" y="11" width="8" height="8" stroke="green" + clip-path="circle() view-box" /> +</svg></pre> + +<p>{{EmbedLiveSample('topExample', '100%', 200)}}</p> +</div> + +<h2 id="Usage_notes">Usage notes</h2> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">值</th> + <td>{{cssxref('url')}} | [ {{cssxref('basic-shape')}} || <code><geometry-box></code> ] | <code>none</code></td> + </tr> + <tr> + <th scope="row">默认值</th> + <td><code>none</code></td> + </tr> + <tr> + <th scope="row">Animatable</th> + <td>是</td> + </tr> + </tbody> +</table> + +<dl> + <dt><geometry-box></dt> + <dd>geometry-box 是应用 {{cssxref('basic-shape')}} 的额外信息,用于区分 CSS 基本形状如何应用于元素上:<code>fill-box</code> 表示将对象的包围框作为参照框;<code>stroke-box</code> 表示将对象的包围框加上描边的范围作为参照框;<code>view-box</code> 表示使用最近的 SVG 视窗作为参照框。</dd> +</dl> + +<p class="note"><strong>注意:</strong>clip-path 语法的更多细节可参考 CSS 属性 {{cssxref('clip-path')}} 的参考页面。</p> + +<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容</h2> + + + +<p>{{Compat("svg.attributes.presentation.clip-path")}}</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("CSS Masks", "#the-clip-path", 'clip-path')}}</td> + <td>{{Spec2('CSS Masks')}}</td> + <td>Extends its application to HTML elements. The <code>clip-path</code> property replaces the deprecated {{cssxref("clip")}} property.</td> + </tr> + <tr> + <td>{{SpecName('SVG1.1', 'masking.html#ClipPathProperty', 'clip-path')}}</td> + <td>{{Spec2('SVG1.1')}}</td> + <td>Initial definition (applies to SVG elements only).</td> + </tr> + </tbody> +</table> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The CSS {{cssxref("clip-path")}} property</li> +</ul> |