From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/css/transform-function/scalex()/index.html | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 files/zh-cn/web/css/transform-function/scalex()/index.html (limited to 'files/zh-cn/web/css/transform-function/scalex()') diff --git a/files/zh-cn/web/css/transform-function/scalex()/index.html b/files/zh-cn/web/css/transform-function/scalex()/index.html new file mode 100644 index 0000000000..c5a34d3e40 --- /dev/null +++ b/files/zh-cn/web/css/transform-function/scalex()/index.html @@ -0,0 +1,109 @@ +--- +title: scaleX() +slug: Web/CSS/transform-function/scaleX() +tags: + - axial symmetry + - scaleX() + - scaleX(-1) +translation_of: Web/CSS/transform-function/scaleX() +--- +
{{CSSRef}}
+ +

scaleX() CSS 函数将每个元素点的横坐标修改为一个常数因子,除了该比例因子为1,在这种情况下,函数是身份变换。 缩放不是各向同性的,并且元素的角度不保守。

+ +

+ +

scaleX(sx)scale(sx, 1)scale3d(sx, 1, 1) 的一个速记/缩写。

+ +
+

Note:

+ +

scaleX(-1) 定义一个 轴向对称性(axial symmetry) ,它具有一个垂直轴通过原点 (由 {{cssxref("transform-origin")}} 属性规定)。

+
+ +

Syntax

+ +
scaleX(s)
+
+ +

Values

+ +
+
s
+
Is a {{cssxref("<number>")}} representing the scaling factor to apply on the abscissa of each point of the element.
+
+ + + + + + + + + + + + + + + + + + + + + +
Cartesian coordinates on ℝ2Homogeneous coordinates on ℝℙ2Cartesian coordinates on ℝ3Homogeneous coordinates on ℝℙ3
s0 01 s00010001 s00010001 s000010000100001
[s 0 0 1 0 0]
+ +

Examples

+ +

Without changing the origin

+ +

HTML

+ +
<p>foo</p>
+<p class="transformed">bar</p>
+ +

CSS

+ +
p {
+  width: 50px;
+  height: 50px;
+  background-color: teal;
+}
+
+.transformed {
+  transform: scaleX(2);
+  background-color: blue;
+}
+
+ +

Result

+ +

{{EmbedLiveSample("Without_changing_the_origin","100%","200")}}

+ +

Translating the origin of the transformation

+ +

HTML

+ +
<p>foo</p>
+<p class="transformed">bar</p>
+ +

CSS

+ +
p {
+  width: 50px;
+  height: 50px;
+  background-color: teal;
+}
+
+.transformed {
+  transform: scaleX(2);
+  transform-origin: left;
+  background-color: blue;
+}
+
+ +

Result

+ +

{{EmbedLiveSample("Translating_the_origin_of_the_transformation","100%","200")}}

-- cgit v1.2.3-54-g00ecf