aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/shape-margin/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/css/shape-margin/index.html')
-rw-r--r--files/zh-cn/web/css/shape-margin/index.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/shape-margin/index.html b/files/zh-cn/web/css/shape-margin/index.html
new file mode 100644
index 0000000000..3b3ea4ef4d
--- /dev/null
+++ b/files/zh-cn/web/css/shape-margin/index.html
@@ -0,0 +1,121 @@
+---
+title: shape-margin
+slug: Web/CSS/shape-margin
+tags:
+ - CSS
+ - CSS Property
+ - CSS Shapes
+ - Reference
+ - float
+ - margin
+ - shape-margin
+translation_of: Web/CSS/shape-margin
+---
+<div>{{CSSRef}}</div>
+
+<p><span class="seoSummary"><a href="/en-US/docs/Web/CSS">CSS</a> 属性 <strong><code>shape-margin</code></strong> 用于设定由{{cssxref("shape-outside")}}创建的CSS形状的外边距。</span></p>
+
+<div>{{EmbedInteractiveExample("pages/css/shape-margin.html")}}</div>
+
+
+
+<p>这个外边距可以让你调整(浮动元素的)形状边缘与环绕内容之间的距离。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush:css no-line-numbers">/* &lt;length&gt; values */
+shape-margin: 10px;
+shape-margin: 20mm;
+
+/* &lt;percentage&gt; value */
+shape-margin: 60%;
+
+/* Global values */
+shape-margin: inherit;
+shape-margin: initial;
+shape-margin: unset;
+</pre>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt><code>&lt;length-percentage&gt;</code></dt>
+ <dd>使用{{cssxref("&lt;length&gt;")}}值,或者相对于元素容纳块的{{cssxref("&lt;percentage&gt;")}}值来设定形状的外边距。</dd>
+</dl>
+
+<h3 id="正式语法">正式语法</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="范例">范例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;section&gt;
+&lt;div class="shape"&gt;&lt;/div&gt;
+We are not quite sure of any one thing in biology; our knowledge of geology
+is relatively very slight, and the economic laws of society are
+uncertain to every one except some individual who attempts to set them
+forth; but before the world was fashioned the square on the hypotenuse
+was equal to the sum of the squares on the other two sides of a right
+triangle, and it will be so after this world is dead; and the inhabitant
+of Mars, if he exists, probably knows its truth as we know it.&lt;/section&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">section {
+ max-width: 400px;
+}
+
+.shape {
+ float: left;
+ width: 150px;
+ height: 150px;
+ background-color: maroon;
+ clip-path: polygon(0 0, 150px 150px, 0 150px);
+ shape-outside: polygon(0 0, 150px 150px, 0 150px);
+ shape-margin: 20px;
+}</pre>
+
+<h3 id="Result">Result</h3>
+
+<p><iframe class="live-sample-frame sample-code-frame" frameborder="0" height="250" id="frame_Example" src="https://mdn.mozillademos.org/zh-CN/docs/Web/CSS/shape-margin$samples/Example?revision=1608812" width="500"></iframe></p>
+
+<h2 id="规范">规范</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 Shapes', '#shape-margin-property', 'shape-margin')}}</td>
+ <td>{{Spec2('CSS Shapes')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>
+
+
+<p>{{Compat("css.properties.shape-margin")}}</p>
+</div>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/CSS/CSS_Shapes">CSS Shapes</a></li>
+ <li><a href="/en-US/docs/Web/CSS/CSS_Shapes/Overview_of_CSS_Shapes">Overview of CSS Shapes</a></li>
+ <li>{{cssxref("shape-outside")}}</li>
+ <li>{{cssxref("shape-image-threshold")}}</li>
+ <li>{{cssxref("&lt;basic-shape&gt;")}}</li>
+</ul>