質問編集履歴
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,20 +5,70 @@
|
|
5
5
|
とあるのですが、50%の位置また、引き算が成立するのはなぜですか
|
6
6
|
|
7
7
|
```
|
8
|
-
header{
|
9
|
-
height:200px;
|
10
|
-
background : silver;
|
11
|
-
position: relative;
|
12
|
-
}
|
13
8
|
|
9
|
+
<!DOCTYPE html>
|
10
|
+
|
11
|
+
<html lang="ja">
|
12
|
+
|
13
|
+
<head>
|
14
|
+
|
15
|
+
<meta charset="utf-8">
|
16
|
+
|
17
|
+
<title>CSSの練習</title>
|
18
|
+
|
19
|
+
<link rel="stylesheet" href="css/styles.css">
|
20
|
+
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body>
|
24
|
+
|
25
|
+
<header>
|
26
|
+
|
27
|
+
<div></div>
|
28
|
+
|
29
|
+
</header>
|
30
|
+
|
31
|
+
</body>
|
32
|
+
|
33
|
+
</html>
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
```
|
38
|
+
|
14
|
-
|
39
|
+
body {
|
15
|
-
|
40
|
+
|
16
|
-
|
41
|
+
margin: 0;
|
17
|
-
|
42
|
+
|
18
|
-
position:absolute;
|
19
|
-
top: calc(50% - 20 px);
|
20
|
-
left: calc(50% - 50 px);
|
21
43
|
}
|
22
44
|
|
45
|
+
|
23
46
|
|
47
|
+
header {
|
48
|
+
|
49
|
+
height: 200px;
|
50
|
+
|
51
|
+
background: silver;
|
52
|
+
|
53
|
+
position: relative;
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
div {
|
60
|
+
|
61
|
+
width: 100px;
|
62
|
+
|
63
|
+
height: 40px;
|
64
|
+
|
65
|
+
background: skyblue;
|
66
|
+
|
67
|
+
position: absolute;
|
68
|
+
|
69
|
+
top: calc(50% - 20px);
|
70
|
+
|
71
|
+
left: calc(50% - 50px);
|
72
|
+
|
73
|
+
|
24
74
|
```
|
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
leftに関しては50%の位置からdivの半分の幅を引いてあげればいいでしょう
|
5
5
|
とあるのですが、50%の位置また、引き算が成立するのはなぜですか
|
6
6
|
|
7
|
+
```
|
7
|
-
|
8
|
+
header{
|
8
9
|
height:200px;
|
9
10
|
background : silver;
|
10
11
|
position: relative;
|
@@ -19,5 +20,5 @@
|
|
19
20
|
left: calc(50% - 50 px);
|
20
21
|
}
|
21
22
|
|
22
|
-
|
23
|
+
|
23
24
|
```
|