aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/translate/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/css/translate/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/css/translate/index.html')
-rw-r--r--files/zh-cn/web/css/translate/index.html131
1 files changed, 131 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/translate/index.html b/files/zh-cn/web/css/translate/index.html
new file mode 100644
index 0000000000..d7b88f4ada
--- /dev/null
+++ b/files/zh-cn/web/css/translate/index.html
@@ -0,0 +1,131 @@
+---
+title: translate
+slug: Web/CSS/translate
+tags:
+ - CSS
+ - CSS属性
+ - Transforms
+ - 参考
+ - 实验性
+ - 平移
+translation_of: Web/CSS/translate
+---
+<div>{{CSSRef}}</div>
+
+<p><a href="/en-US/docs/Web/CSS">CSS</a> 属性 <strong><code>translate</code></strong> 允许你单独声明平移变换,并独立于 {{cssxref("transform")}} 属性。这在一些典型的用户界面上更好用,而且这样就无需在 <code>transform</code> 中声明该函数并记住转换函数的确切顺序了。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush: css no-line-numbers notranslate">/* Keyword values */
+translate: none;
+
+/* Single values */
+translate: 100px;
+translate: 50%;
+
+/* Two values */
+translate: 100px 200px;
+translate: 50% 105px;
+
+/* Three values */
+translate: 50% 105px 5rem;
+</pre>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt>单个长度/百分比值</dt>
+ <dd>一个长度值或百分比,表示二维平移,与声明了 X 轴和 Y 轴的平移一样(此时省略的第二个值默认为0)。等同于在 <code>translate()</code> 函数(2D 平移)中指定单个值。</dd>
+ <dt>两个长度/百分比值</dt>
+ <dd>两个长度值或百分比表示在二维上分别按照指定X轴和Y轴的值进行的平移。等同于在 <code>translate()</code> 函数(2D 平移)中函数指定两个值。</dd>
+ <dt>三个长度/百分比值</dt>
+ <dd>三个长度值或百分比,表示分别指定 X 轴、Y 轴、Z 轴的值进行三维平移。等同于<code>translate3d()</code> 函数(3D 平移)。</dd>
+ <dt id="none"><code>none</code></dt>
+ <dd>表示不应用平移效果。</dd>
+</dl>
+
+<h3 id="形式语法">形式语法</h3>
+
+<pre class="syntaxbox notranslate">{{csssyntax}}</pre>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&lt;div&gt;
+  &lt;p class="translate"&gt;Translation&lt;/p&gt;
+&lt;/div&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css notranslate">* {
+ box-sizing: border-box;
+}
+
+html {
+ font-family: sans-serif;
+}
+
+div {
+ width: 150px;
+ margin: 0 auto;
+}
+
+p {
+ padding: 10px 5px;
+ border: 3px solid black;
+ border-radius: 20px;
+ width: 150px;
+ font-size: 1.2rem;
+ text-align: center;
+}
+
+.translate {
+ transition: translate 1s;
+}
+
+div:hover .translate {
+ translate: 200px 50px;
+}
+</pre>
+
+<h3 id="结果">结果</h3>
+
+<p><iframe class="live-sample-frame sample-code-frame" frameborder="0" id="frame_Examples" src="https://mdn.mozillademos.org/en-US/docs/Web/CSS/translate$samples/Examples?revision=1595410"></iframe></p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS Transforms 2', '#individual-transforms', 'individual transforms')}}</td>
+ <td>{{Spec2('CSS Transforms 2')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{CSSInfo}}</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("css.properties.translate")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{cssxref('scale')}}</li>
+ <li>{{cssxref('rotate')}}</li>
+ <li>{{cssxref('transform')}}</li>
+</ul>
+
+<p>注意:skew 不是一个独立的变换属性。</p>