aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/transform-function/rotate/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/css/transform-function/rotate/index.html')
-rw-r--r--files/zh-cn/web/css/transform-function/rotate/index.html91
1 files changed, 91 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/transform-function/rotate/index.html b/files/zh-cn/web/css/transform-function/rotate/index.html
new file mode 100644
index 0000000000..c176ecc3f2
--- /dev/null
+++ b/files/zh-cn/web/css/transform-function/rotate/index.html
@@ -0,0 +1,91 @@
+---
+title: rotate()
+slug: Web/CSS/transform-function/rotate
+tags:
+ - CSS
+ - CSS函数
+ - CSS变换
+translation_of: Web/CSS/transform-function/rotate()
+original_slug: Web/CSS/transform-function/rotate()
+---
+<div>{{CSSRef}}</div>
+
+<div>CSS的<strong><code>rotate()</code></strong>函数定义了一种将元素围绕一个定点(由{{ Cssxref("transform-origin") }}属性指定)旋转而不变形的转换。指定的角度定义了旋转的量度。若角度为正,则顺时针方向旋转,否则逆时针方向旋转。旋转180°也被称为点反射。</div>
+
+
+
+<p>元素旋转的固定点 - 如上所述 - 也称为<strong>变换原点</strong>。这默认为元素的中心,但你可以使用{{ cssxref("transform-origin") }}属性设置自己的自定义变换原点。</p>
+
+<h2 id="语法">语法</h2>
+
+<p>{{cssxref("&lt;angle&gt;")}} 指定了 <code>rotate()</code> 的旋转程度。参数为正时,顺时针旋转;参数为负时,逆时针旋转。180° 旋转称为<em>点反演</em>。</p>
+
+<pre class="syntaxbox notranslate">rotate(<em>a</em>)
+</pre>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt><em>a</em></dt>
+ <dd>是一种{{ cssxref("&lt;angle&gt;") }},表示旋转的角度。 正角度表示了顺时针的旋转,负角度表示逆时针的旋转。</dd>
+</dl>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">
+ <p>笛卡尔坐标系 on ℝ<sup>2</sup></p>
+ </th>
+ <th scope="col">齐次坐标系 on ℝℙ<sup>2</sup></th>
+ <th scope="col">笛卡尔坐标系 on ℝ<sup>3</sup></th>
+ <th scope="col">齐次坐标系 on ℝℙ<sup>3</sup></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="1" rowspan="2"><math> <mfenced> <mtable> <mtr><mtd>cos(a)</mtd><mtd>-sin(a)</mtd></mtr> <mtr><mtd>sin(a)</mtd><mtd>cos(a)</mtd></mtr></mtable></mfenced></math></td>
+ <td><math> <mfenced><mtable><mtr><mtd>cos(a)</mtd><mtd>-sin(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>sin(a)</mtd><mtd>cos(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td>
+ <td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr><mtd>cos(a)</mtd><mtd>-sin(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>sin(a)</mtd><mtd>cos(a)</mtd><mtd>0</mtd></mtr><mtr><mtd>0</mtd><mtd>0</mtd><mtd>1</mtd></mtr></mtable> </mfenced> </math></td>
+ <td colspan="1" rowspan="2"><math> <mfenced><mtable><mtr><mtd>cos(a)</mtd><mtd>-sin(a)</mtd><mtd>0</mtd><mtd>0</mtd></mtr><mtr><mtd>sin(a)</mtd><mtd>cos(a)</mtd><mtd>0</mtd><mtd>0</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>[cos(a) sin(a) -sin(a) cos(a) 0 0]</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&lt;div&gt;Normal&lt;/div&gt;
+&lt;div class="rotated"&gt;Rotated&lt;/div&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css notranslate">div {
+ width: 80px;
+ height: 80px;
+ background-color: skyblue;
+}
+
+.rotated {
+ transform: rotate(45deg); /* Equal to rotateZ(45deg) */
+ background-color: pink;
+}</pre>
+
+<h3 id="结果">结果</h3>
+
+<p>{{EmbedLiveSample("示例","100%","200")}}</p>
+
+<h2 id="浏览器兼容">浏览器兼容</h2>
+
+<p>有关兼容性信息,请参阅<code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function#Browser_compatibility">&lt;transform-function&gt;</a></code>数据类型。</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{cssxref("transform")}}</li>
+ <li>{{cssxref("&lt;transform-function&gt;")}}</li>
+ <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d">rotate3d()</a></code></li>
+</ul>