aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/transform/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/transform/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/transform/index.html')
-rw-r--r--files/zh-cn/web/css/transform/index.html136
1 files changed, 136 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/transform/index.html b/files/zh-cn/web/css/transform/index.html
new file mode 100644
index 0000000000..e956ec6f90
--- /dev/null
+++ b/files/zh-cn/web/css/transform/index.html
@@ -0,0 +1,136 @@
+---
+title: transform
+slug: Web/CSS/transform
+tags:
+ - CSS
+ - CSS Property
+ - Transforms
+translation_of: Web/CSS/transform
+---
+<div>{{CSSRef}}</div>
+
+<div>CSS<strong><code>transform</code></strong>属性允许你旋转,缩放,倾斜或平移给定元素。这是通过修改CSS视觉格式化模型的坐标空间来实现的。</div>
+
+<div>{{EmbedInteractiveExample("pages/css/transform.html")}}</div>
+
+
+
+<div class="warning">
+<p>只能转换由盒模型定位的元素。根据经验,如果元素具有<code>display: block</code>,则由盒模型定位元素。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush: css">/* Keyword values */
+transform: none;
+
+/* Function values */
+transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
+transform: translate(12px, 50%);
+transform: translateX(2em);
+transform: translateY(3in);
+transform: scale(2, 0.5);
+transform: scaleX(2);
+transform: scaleY(0.5);
+transform: rotate(0.5turn);
+transform: skew(30deg, 20deg);
+transform: skewX(30deg);
+transform: skewY(1.07rad);
+transform: matrix3d(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
+transform: translate3d(12px, 50%, 3em);
+transform: translateZ(2px);
+transform: scale3d(2.5, 1.2, 0.3);
+transform: scaleZ(0.3);
+transform: rotate3d(1, 2.0, 3.0, 10deg);
+transform: rotateX(10deg);
+transform: rotateY(10deg);
+transform: rotateZ(10deg);
+transform: perspective(17px);
+
+/* Multiple function values */
+transform: translateX(10px) rotate(10deg) translateY(5px);
+
+/* Global values */
+transform: inherit;
+transform: initial;
+transform: unset;
+</pre>
+
+<p><code>transform</code>属性可以指定为关键字值<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform$edit#none">none</a></code> 或一个或多个<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform$edit#%3Ctransform-function%3E">&lt;transform-function&gt;</a></code>值。</p>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt id="&lt;transform-function>">{{cssxref("&lt;transform-function&gt;")}}</dt>
+ <dd>要应用的一个或多个CSS变换函数。 变换函数按从左到右的顺序相乘,这意味着复合变换按从右到左的顺序有效地应用。</dd>
+ <dt id="none"><code>none</code></dt>
+ <dd>不应用任何变换。</dd>
+</dl>
+
+<h3 id="语法格式">语法格式</h3>
+
+<pre>{{csssyntax}}
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html"><code>&lt;div&gt;Transformed element&lt;/div&gt;</code></pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css"><code>div {
+ border: solid red;
+ transform: translate(30px, 20px) rotate(20deg);
+ width: 140px;
+ height: 60px;
+}</code></pre>
+
+<h3 id="结果">结果</h3>
+
+<p>{{EmbedLiveSample("示例", "400", "160")}}</p>
+
+<p>有关更多示例,请参阅<a href="/zh-CN/docs/Web/CSS/CSS_Transitions">使用CSS变换</a>和{{cssxref("&lt;transform-function&gt;")}}。</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', '#transform-functions', 'transform')}}</td>
+ <td>{{Spec2('CSS Transforms 2')}}</td>
+ <td>Adds 3D transform functions.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS3 Transforms', '#transform-property', 'transform')}}</td>
+ <td>{{Spec2('CSS3 Transforms')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("css.properties.transform")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="https://developer.mozilla.org/en-US/docs/CSS/Using_CSS_transforms">Using CSS transforms</a></li>
+ <li>{{cssxref("&lt;transform-function&gt;")}} data type</li>
+ <li>A cross-browser 2D <a href="https://louisremi.github.io/jquery.transform.js/">transform plugin for jQuery</a></li>
+</ul>