-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
152 lines (123 loc) · 3.29 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
title: scaleX()
slug: Web/CSS/transform-function/scaleX
---
{{CSSRef}}
**`scaleX()`** CSS 函数将每个元素点的横坐标修改为一个常数因子,除了该比例因子为 1,在这种情况下,函数是身份变换。缩放不是各向同性的,并且元素的角度不保守。
![](scalex.png)
`scaleX(sx)` 是 `scale(sx, 1)` 或 `scale3d(sx, 1, 1)` 的一个速记/缩写。
> **备注:** **`scaleX(-1)`** 定义一个 [轴向对称性](https://zh.wikipedia.org/wiki/軸對稱),它具有一个垂直轴通过原点(由 {{cssxref("transform-origin")}} 属性规定)。
## Syntax
```css
scaleX(s)
```
## Values
- _s_
- : Is a {{cssxref("<number>")}} representing the scaling factor to apply on the abscissa of each point of the element.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th>
<th scope="col">Homogeneous coordinates on ℝℙ<sup>2</sup></th>
<th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th>
<th scope="col">Homogeneous coordinates on ℝℙ<sup>3</sup></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="1" rowspan="2">
<math
><mfenced
><mtable
><mtr><mtd>s</mtd><mtd>0</mtd></mtr>
<mtr><mtd>0</mtd><mtd>1</mtd></mtr></mtable
></mfenced
></math
>
</td>
<td>
<math
><mfenced
><mtable
><mtr>s<mtd>0</mtd><mtd>0</mtd></mtr
><mtr>0<mtd>1</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>s<mtd>0</mtd><mtd>0</mtd></mtr
><mtr>0<mtd>1</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>s<mtd>0</mtd><mtd>0</mtd><mtd>0</mtd></mtr
><mtr>0<mtd>1</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>[s 0 0 1 0 0]</code></td>
</tr>
</tbody>
</table>
## Examples
### Without changing the origin
#### HTML
```html
<p>foo</p>
<p class="transformed">bar</p>
```
#### CSS
```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
```html
<p>foo</p>
<p class="transformed">bar</p>
```
#### CSS
```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")}}
## 规范
{{Specifications}}