aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/clip-path/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/svg/attribute/clip-path/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-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.html111
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">&lt;svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"&gt;
+ &lt;clipPath id="myClip" clipPathUnits="objectBoundingBox"&gt;
+ &lt;circle cx=".5" cy=".5" r=".5" /&gt;
+ &lt;/clipPath&gt;
+
+ &lt;!-- 左上:应用自定义的剪切路径 --&gt;
+ &lt;rect x="1" y="1" width="8" height="8" stroke="green"
+ clip-path="url(#myClip)" /&gt;
+
+ &lt;!-- 右上:应用 CSS 基本形状和 fill-box 几何。
+  实质上和自定义剪切路径并把 clipPathUnits
+ 设成 objectBoundingBox 一样 --&gt;
+ &lt;rect x="11" y="1" width="8" height="8" stroke="green"
+ clip-path="circle() fill-box" /&gt;
+
+ &lt;!-- 左下 --&gt;
+ &lt;rect x="1" y="11" width="8" height="8" stroke="green"
+ clip-path="circle() stroke-box" /&gt;
+
+ &lt;!-- 右下:应用CSS基本形状和 view-box 几何。
+ 实质上和自定义剪切路径并把 clipPathUnits
+ 设成 userSpaceOnUse 一样 --&gt;
+ &lt;rect x="11" y="11" width="8" height="8" stroke="green"
+ clip-path="circle() view-box" /&gt;
+&lt;/svg&gt;</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>&lt;geometry-box&gt;</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>&lt;geometry-box&gt;</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>