diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/transform-function/translatey()/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/transform-function/translatey()/index.html')
-rw-r--r-- | files/zh-cn/web/css/transform-function/translatey()/index.html | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/transform-function/translatey()/index.html b/files/zh-cn/web/css/transform-function/translatey()/index.html new file mode 100644 index 0000000000..3c210ee62e --- /dev/null +++ b/files/zh-cn/web/css/transform-function/translatey()/index.html @@ -0,0 +1,115 @@ +--- +title: translateY() +slug: Web/CSS/transform-function/translateY() +translation_of: Web/CSS/transform-function/translateY() +--- +<div>{{CSSRef}}</div> + +<p><code>translateY()</code> 在页面垂直移动元素,结果是 CSS 数据类型 {{cssxref("<transform-function>")}}。</p> + +<p><img src="https://mdn.mozillademos.org/files/12125/translateY.png" style="height: 195px; width: 243px;"></p> + +<div class="note"> +<p><strong>注意:</strong> <code>translateY(ty)</code> 对应 <code><a href="/en-US/docs/Web/CSS/transform-function/translate">translate</a>(0, ty)</code> 或<code><a href="/en-US/docs/Web/CSS/transform-function/translate3d">translate3d</a>(0, ty, 0)</code>。</p> +</div> + +<h2 id="语法">语法</h2> + +<pre class="notranslate"><code>/* <length-percentage> values */ +transform: translateY(200px); +transform: translateY(50%);</code></pre> + +<h2 id="值">值</h2> + +<dl> + <dd>{{cssxref("<length>")}} 或 {{cssxref("<percentage>")}} 表示变换向量的纵坐标。百分比指的是盒子高度,盒子由属性 {{cssxref("transform-box")}} 定义。</dd> +</dl> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">笛卡尔坐标 ℝ<sup>2</sup></th> + <th scope="col"> + <p>在ℝℙ<sup>2</sup>上的同类坐标</p> + </th> + <th scope="col"> + <p>在ℝ<sup>3</sup>上的笛卡尔坐标</p> + </th> + <th scope="col"> + <p>在ℝℙ<sup>3</sup>同类坐标</p> + </th> + </tr> + </thead> + <tbody> + <tr> + <td colspan="1" rowspan="2"> + <p>在ℝ<sup>2 </sup>上的转换不会是线性变换但是并不能代表在笛卡尔坐标系统中使用矩阵</p> + </td> + <td><math> <mfenced><mtable><mtr>1<mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>t</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td> + <td colspan="1" rowspan="2"><math> <math> <mfenced><mtable><mtr>1<mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>t</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></math></td> + <td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr>1<mtd>0</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr>0<mtd>1</mtd><mtd>0</mtd><mtd>t</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td> + </tr> + <tr> + <td><code>[1 0 0 1 0 t]</code></td> + </tr> + </tbody> +</table> + +<h3 id="语法_2">语法</h3> + +<pre class="notranslate">translateY({{cssxref("<length-percentage>")}})</pre> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="notranslate"><code><div>Static</div> +<div class="moved">Moved</div> +<div>Static</div></code></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="notranslate"><code>div { + width: 60px; + height: 60px; + background-color: skyblue; +} + +.moved { + transform: translateY(10px); + background-color: pink; +}</code></pre> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample("Examples", 250, 250)}}</p> + +<h2 id="规范">规范</h2> + +<table> + <thead> + <tr> + <th scope="col"><strong>规范</strong></th> + <th scope="col"><strong>状态</strong></th> + <th scope="col"><strong>注释</strong></th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("CSS3 Transforms", "#funcdef-transform-translatey", "translateY()")}}</td> + <td>{{Spec2("CSS3 Transforms")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>请查看 <code><a href="https://wiki.developer.mozilla.org/en-US/docs/Web/CSS/transform-function#Browser_compatibility"><transform-function></a></code>。</p> + +<h2 id="了解更多">了解更多</h2> + +<ul> + <li>{{cssxref("transform")}}</li> + <li>{{cssxref("<transform-function>")}}</li> +</ul> |