質問編集履歴

1

ソースコードを追記

2018/05/01 04:15

投稿

machine_machine
machine_machine

スコア162

test CHANGED
File without changes
test CHANGED
@@ -19,3 +19,49 @@
19
19
 
20
20
 
21
21
  何かいい方法はありますでしょうか。
22
+
23
+
24
+
25
+ ```html
26
+
27
+ <div class="image">
28
+
29
+ <img src="//placehold.it/200" alt="">
30
+
31
+ </div>
32
+
33
+ ```
34
+
35
+
36
+
37
+ ```css
38
+
39
+ .image {
40
+
41
+ width: 100px;
42
+
43
+ height: 100px;
44
+
45
+ position: relative;
46
+
47
+ background: #c33;
48
+
49
+ }
50
+
51
+
52
+
53
+ img {
54
+
55
+ display: block;
56
+
57
+ position: absolute;
58
+
59
+ top: 50%;
60
+
61
+ left: 50%;
62
+
63
+ transform: translate3d(-50%, -50%, 0);
64
+
65
+ }
66
+
67
+ ```