aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/transform-function/translatex()/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2021-07-16 16:27:00 -0400
committerGitHub <noreply@github.com>2021-07-17 04:27:00 +0800
commitb9afb23d12dcae1e09f8d04c72143c5ddaa34aea (patch)
treef6c20844119bcaf0131ad4a037e0245577927f2c /files/zh-cn/web/css/transform-function/translatex()/index.html
parent1aa671566c3a990ec2df9a46137471d624b6f7ff (diff)
downloadtranslated-content-b9afb23d12dcae1e09f8d04c72143c5ddaa34aea.tar.gz
translated-content-b9afb23d12dcae1e09f8d04c72143c5ddaa34aea.tar.bz2
translated-content-b9afb23d12dcae1e09f8d04c72143c5ddaa34aea.zip
delete conflicting/orphaned docs (zh-CN) (#1412)
* delete conflicting docs (zh-CN) * and redirects * do orphaned as well * fix * remove more orphans * revert orphaned docs that can identify origin * move orphaned docs to current loc * adjust slug path * fix redirect change from rebase Co-authored-by: Irvin <irvinfly@gmail.com>
Diffstat (limited to 'files/zh-cn/web/css/transform-function/translatex()/index.html')
-rw-r--r--files/zh-cn/web/css/transform-function/translatex()/index.html132
1 files changed, 132 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/transform-function/translatex()/index.html b/files/zh-cn/web/css/transform-function/translatex()/index.html
new file mode 100644
index 0000000000..c800a6c7eb
--- /dev/null
+++ b/files/zh-cn/web/css/transform-function/translatex()/index.html
@@ -0,0 +1,132 @@
+---
+title: translateX()
+slug: Web/CSS/transform-function/translateX()
+translation_of: Web/CSS/transform-function/translateX()
+tags:
+ - CSS
+ - CSS Function
+ - CSS Transforms
+ - Function
+ - Reference
+browser-compat: css.types.transform-function.translateX
+---
+<div>{{CSSRef}}</div>
+
+<p>translateX()函数表示在二维平面上水平方向移动元素。 其结果的数据类型是{{cssxref("&lt;transform-function&gt;")}}。</p>
+
+<p><img src="https://mdn.mozillademos.org/files/3544/transform-functions-translateX_2.png" style="height: 146px; width: 243px;"></p>
+
+<div class="note">
+<p><strong>注意</strong>: <code>translateX(tx)</code>等同于 <a href="/en-US/docs/Web/CSS/transform-function/translate">translate</a>(tx, 0) 或者 <a href="/en-US/docs/Web/CSS/transform-function/translate3d">translate3d</a>(tx, 0, 0)。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">translateX(t)
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>t</code></dt>
+ <dt>     代表了向量平移的横坐标长度{{cssxref("&lt;length&gt;")}}。</dt>
+</dl>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">ℝ<sup>2</sup>空间中的笛卡尔坐标</th>
+ <th scope="col">在ℝℙ<sup>2</sup>上的投影坐标</th>
+ <th scope="col">在ℝ<sup>3</sup>上的笛卡尔坐标</th>
+ <th scope="col">在ℝℙ<sup>3</sup>上的投影坐标</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="1" rowspan="2">
+ <p>在ℝ<sup>2 </sup>空间中的平移并非线性变化,因此不能表示为笛卡尔坐标矩阵。</p>
+ </td>
+ <td>
+ <p><math> <mfenced><mtable><mtr>1 <mtd>0 </mtd><mtd>t</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr>0 <mtd>1 </mtd><mtd>0</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr><mtd>0 </mtd><mtd>0 </mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></p>
+ </td>
+ <td colspan="1" rowspan="2">
+ <p><math> <mfenced><mtable><mtr>1 <mtd>0 </mtd><mtd>t</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr>0 <mtd>1 </mtd><mtd>0</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr><mtd>0 </mtd><mtd>0 </mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></p>
+ </td>
+ <td colspan="1" rowspan="2">
+ <p><math> <mfenced><mtable><mtr>1 <mtd>0 </mtd><mtd>0 </mtd><mtd>t</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr>0 <mtd>1 </mtd><mtd>0 </mtd><mtd>0</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr><mtd>0 </mtd><mtd>0 </mtd><mtd>1 </mtd><mtd>0</mtd></mtr></mtable></mfenced></math></p>
+
+ <p><math><mfenced><mtable><mtr><mtd></mtd></mtr><mtr><mtd>0 </mtd><mtd>0 </mtd><mtd>0 </mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>[1 0 0 1 t 0]</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html"><code>&lt;div&gt;Static&lt;/div&gt;
+&lt;div class="moved"&gt;Moved&lt;/div&gt;
+&lt;div&gt;Static&lt;/div&gt;</code></pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css"><code>div {
+ width: 60px;
+ height: 60px;
+ background-color: skyblue;
+}
+
+.moved {
+ transform: translateX(10px); /* 等同于 translate(10px) */
+ background-color: pink;
+}</code></pre>
+
+<h3 id="结果">结果</h3>
+
+<p>{{EmbedLiveSample("Examples", 250, 250)}}</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("CSS3 Transforms", "#funcdef-transform-translatex", "translateX()")}}</td>
+ <td>{{Spec2("CSS3 Transforms")}}</td>
+ <td>原始定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>请前往数据类型{{cssxref("transform-function")}}的页面以查看兼容性信息。</p>
+
+<h2 id="参阅">参阅</h2>
+
+<ul>
+ <li>{{cssxref("transform")}}</li>
+ <li>{{cssxref("&lt;transform-function&gt;")}}</li>
+</ul>