質問編集履歴

2

rotateの動きを比較するためのコードを下に追記

2020/12/29 07:47

投稿

aoi68
aoi68

スコア9

test CHANGED
File without changes
test CHANGED
@@ -173,3 +173,99 @@
173
173
  });
174
174
 
175
175
  ```
176
+
177
+
178
+
179
+ ```html
180
+
181
+ <!DOCTYPE html>
182
+
183
+ <html lang="en">
184
+
185
+ <head>
186
+
187
+ <meta charset="UTF-8">
188
+
189
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
190
+
191
+ <link rel="stylesheet" href="/css/style.css">
192
+
193
+ <title>rotate</title>
194
+
195
+ </head>
196
+
197
+ <body>
198
+
199
+ <div class="all">
200
+
201
+ <div id="all1"></div>
202
+
203
+ </div>
204
+
205
+ <div class="all" style=" margin-top: 50px;">
206
+
207
+ <div id="all2"></div>
208
+
209
+ </div>
210
+
211
+ </body>
212
+
213
+ </html>
214
+
215
+ ```
216
+
217
+
218
+
219
+ ```css
220
+
221
+ .all {
222
+
223
+ height: 200px;
224
+
225
+ width: 200px;
226
+
227
+ background: gray;
228
+
229
+ text-align: center;
230
+
231
+ margin: 0 auto;
232
+
233
+ }
234
+
235
+
236
+
237
+ #all1 {
238
+
239
+ height: 100px;
240
+
241
+ width: 100px;
242
+
243
+ background: green;
244
+
245
+ margin-top: 50px;
246
+
247
+ display: inline-block;
248
+
249
+ transform: translate(30px, 0) rotate(45deg);
250
+
251
+ }
252
+
253
+
254
+
255
+ #all2 {
256
+
257
+ height: 100px;
258
+
259
+ width: 100px;
260
+
261
+ background: red;
262
+
263
+ margin-top: 50px;
264
+
265
+ display: inline-block;
266
+
267
+ transform:rotate(45deg) translate(30px, 0);
268
+
269
+ }
270
+
271
+ ```

1

.active div:nth-of-type(1)にoriginを追加しました。

2020/12/29 07:47

投稿

aoi68
aoi68

スコア9

test CHANGED
File without changes
test CHANGED
@@ -128,6 +128,10 @@
128
128
 
129
129
  transform: rotate(45deg) translate(-50%, 0);
130
130
 
131
+ -webkit-transform-origin: 0% 50%;
132
+
133
+ transform-origin: 0% 50%;
134
+
131
135
  }
132
136
 
133
137