diff options
Diffstat (limited to 'files/zh-cn/web/css/transform-function/rotatex/index.html')
-rw-r--r-- | files/zh-cn/web/css/transform-function/rotatex/index.html | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/transform-function/rotatex/index.html b/files/zh-cn/web/css/transform-function/rotatex/index.html new file mode 100644 index 0000000000..f534ced0bf --- /dev/null +++ b/files/zh-cn/web/css/transform-function/rotatex/index.html @@ -0,0 +1,108 @@ +--- +title: rotateX() +slug: Web/CSS/transform-function/rotateX +translation_of: Web/CSS/transform-function/rotateX() +original_slug: Web/CSS/transform-function/rotateX() +--- +<div>{{CSSRef}}</div> + +<p><strong><code>rotateX() </code></strong>函数定义了一个转换,它可以让一个元素围绕横坐标(水平轴)旋转,而不会对其进行变形。它的结果是一个{{cssxref("<transform-function>")}}数据类型。</p> + +<div>{{EmbedInteractiveExample("pages/css/function-rotateX.html")}}</div> + + + +<p>旋转轴围绕原点旋转,而这个原点通过{{cssxref("transform-origin")}} 属性来定义。</p> + +<div class="note"> +<p><strong>注意:</strong> <code>rotateX(a)</code> 相当于 <code><a href="/en-US/docs/Web/CSS/transform-function/rotate3d">rotate3d</a>(1, 0, 0, a)</code>.</p> +</div> + +<div class="note"><strong>注意:</strong> 与二维平面上的旋转不同,三维旋转的组合通常是不可交换的。换句话说,三维旋转的应用顺序,将会影响最终结果。</div> + +<h2 id="语法">语法</h2> + +<p><strong><code>rotateX() </code></strong>引起的旋转量由{{cssxref("<angle>")}}指定。如果为正,则顺时针方向移动;如果为负,则逆时针方向移动。</p> + +<pre class="syntaxbox">rotateX(<em>a</em>) +</pre> + +<h3 id="参数值">参数值</h3> + +<dl> + <dt><code>a</code></dt> + <dd><code>a</code> 是一个{{cssxref("<angle>")}} ,表示旋转的角度。正数角度表示顺时针旋转,负数则表示逆时针旋转。</dd> +</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="2">This transformation applies to the 3D space and can't be represented on the plane.</td> + <td colspan="1"><math> <mfenced><mtable><mtr><mtd>1</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>cos(a)</mtd><mtd>-sin(a)</mtd></mtr><mtr><mtd>0</mtd><mtd>sin(a)</mtd><mtd>cos(a)</mtd></mtr></mtable> </mfenced> </math></td> + <td colspan="1"><math><mfenced><mtable><mtr><mtd>1</mtd><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>cos(a)</mtd><mtd>-sin(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>sin(a)</mtd><mtd>cos(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td> + </tr> + </tbody> +</table> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div>Normal</div> +<div class="rotated">Rotated</div></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css">div { + width: 80px; + height: 80px; + background-color: skyblue; +} + +.rotated { + transform: rotateX(45deg); + background-color: pink; +} +</pre> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample("示例", "auto", 180)}}</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 Transforms 2", "#funcdef-rotatex", "rotateX()")}}</td> + <td>{{Spec2("CSS Transforms 2")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容">浏览器兼容</h2> + +<p>有关兼容性信息,请参阅 <code><a href="/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> |