aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/margin-block
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/css/margin-block
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/css/margin-block')
-rw-r--r--files/zh-cn/web/css/margin-block/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/margin-block/index.html b/files/zh-cn/web/css/margin-block/index.html
new file mode 100644
index 0000000000..696903ab8f
--- /dev/null
+++ b/files/zh-cn/web/css/margin-block/index.html
@@ -0,0 +1,96 @@
+---
+title: margin-block
+slug: Web/CSS/margin-block
+translation_of: Web/CSS/margin-block
+---
+<p>{{CSSRef}}{{SeeCompatTable}} </p>
+
+<p><strong><code>margin-block</code></strong>这个<a href="/en-US/docs/Web/CSS" title="CSS">CSS</a>属性定义了一个元素的逻辑块开始和结束边距,根据元素的写入模式、 方向性和文本方向映射到物理边界。</p>
+
+<pre class="brush:css no-line-numbers">/* 有长度的具体的值 */
+margin-block: 10px 20px; /* 一个绝对的长度值 */
+margin-block: 1em 2em; /* 相对于文本大小的值 */
+margin-block: 5% 2%; /* 相对于最近的块容器宽度的值 */
+margin-block: 10px; /* 设置开始值和结束值 */
+
+/* 关键字 值 */
+margin-block: auto;
+
+/* 全局 值 */
+margin-block: inherit;
+margin-block: initial;
+margin-block: unset;
+</pre>
+
+<p>这些值对应的是{{CSSxRef("margin-top")}}和{{CSSxRef("margin-bottom")}},或者 {{CSSxRef("margin-right")}},和{{CSSxRef("margin-left")}},这些属性取决于{{CSSxRef("writing-mode")}},{{CSSxRef("direction")}},和{{CSSxRef("text-orientation")}}。</p>
+
+<p>这些值可以单独设置为{{CSSxRef("margin-block-start")}}和{{CSSxRef("margin-block-end")}}。inline direction属性是{{CSSxRef("margin-inline")}},也可设置为{{CSSxRef("margin-inline-start")}},和{{CSSxRef("margin-inline-end")}}。</p>
+
+<h2 id="语法">语法</h2>
+
+<h3 id="值">值</h3>
+
+<p><code>margin-block</code>属性采用和{{CSSxRef("margin-left")}}属性相同的值。</p>
+
+<h3 id="正规语法">正规语法</h3>
+
+<pre class="syntaxbox">{{CSSSyntax}}</pre>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="HTML_部分">HTML 部分</h3>
+
+<pre class="brush: html">&lt;div&gt;
+ &lt;p class="exampleText"&gt;Example text&lt;/p&gt;
+&lt;/div&gt;
+</pre>
+
+<h3 id="CSS_部分">CSS 部分</h3>
+
+<pre class="brush: css">div {
+ background-color: yellow;
+ width: 120px;
+ height: 120px;
+}
+
+.exampleText {
+ writing-mode: vertical-rl;
+ margin-block: 20px 40px;
+ background-color: #c8c800;
+}</pre>
+
+<p>{{EmbedLiveSample("Example", 140, 140)}}</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 Logical Properties", "#propdef-margin-block", "margin-block")}}</td>
+ <td>{{Spec2("CSS Logical Properties")}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{CSSInfo}}</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">这个页面上的兼容性表格是从结构化数据生成的。 如果你想贡献相关数据,请卢兰<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>并向我们发送请求。</div>
+
+<p>{{Compat("css.properties.margin-block")}}</p>
+
+<h2 id="请参考">请参考</h2>
+
+<ul>
+ <li>所映射的物理特性: {{CSSxRef("margin-top")}},{{CSSxRef("margin-right")}},{{CSSxRef("margin-bottom")}}和{{CSSxRef("margin-left")}}</li>
+ <li>{{CSSxRef("writing-mode")}},{{CSSxRef("direction")}},{{CSSxRef("text-orientation")}}</li>
+</ul>