質問編集履歴

3

タグ追加

2018/12/29 09:16

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes

2

例が親要素使っていなかったので修正

2018/12/29 09:16

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -32,17 +32,25 @@
32
32
 
33
33
  ```css
34
34
 
35
- .container {
35
+ .parent {
36
-
37
- display: grid;
38
36
 
39
37
  width : 300px;
40
38
 
41
39
  height: 600px;
42
40
 
41
+ }
42
+
43
+ .container {
44
+
45
+ display: grid;
46
+
47
+ width: 100%;
48
+
49
+ height: 100%;
50
+
43
51
  grid-template-columns: repeat(3, calc(100% / 3));
44
52
 
45
- grid-template-rows: repeat(3, calc(100% / 3));
53
+ grid-template-rows: repeat(3, calc(100% / 3));
46
54
 
47
55
  }
48
56
 
@@ -50,25 +58,29 @@
50
58
 
51
59
  ```html
52
60
 
53
- <div class="container">
61
+ <div class="parent">
54
62
 
55
- <div style="background-color: gray"></div>
63
+ <div class="container">
56
64
 
57
- <div style="background-color: black"></div>
65
+ <div style="background-color: gray">a</div>
58
66
 
59
- <div style="background-color: gray"></div>
67
+ <div style="background-color: black">a</div>
60
68
 
61
- <div style="background-color: black"></div>
69
+ <div style="background-color: gray"></div>
62
70
 
63
- <div style="background-color: gray"></div>
71
+ <div style="background-color: black"></div>
64
72
 
65
- <div style="background-color: black"></div>
73
+ <div style="background-color: gray"></div>
66
74
 
67
- <div style="background-color: gray"></div>
75
+ <div style="background-color: black"></div>
68
76
 
69
- <div style="background-color: black"></div>
77
+ <div style="background-color: gray"></div>
70
78
 
79
+ <div style="background-color: black"></div>
80
+
71
- <div style="background-color: gray"></div>
81
+ <div style="background-color: gray"></div>
82
+
83
+ </div>
72
84
 
73
85
  </div>
74
86
 

1

コードの説明を追加

2018/12/29 08:56

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -23,6 +23,10 @@
23
23
 
24
24
 
25
25
  ### コード(再現環境に同じ)
26
+
27
+
28
+
29
+ これだと(当たり前だが)縦が600pxをベースに計算するのでダメ。
26
30
 
27
31
 
28
32