回答編集履歴

3

コード修正

2019/12/24 18:39

投稿

hatena19
hatena19

スコア33740

test CHANGED
@@ -57,6 +57,8 @@
57
57
  height: calc(22vw * 4 / 3);
58
58
 
59
59
  }
60
+
61
+ .img-list::before{
60
62
 
61
63
  content:"";
62
64
 

2

コード追加

2019/12/24 18:39

投稿

hatena19
hatena19

スコア33740

test CHANGED
@@ -87,3 +87,69 @@
87
87
  縦横比 4:3 固定
88
88
 
89
89
  4列→2列のブレークポイント 700px
90
+
91
+
92
+
93
+ CSS Grid での実装例(IE10非対応)
94
+
95
+ ```css
96
+
97
+ .content {
98
+
99
+ width: 95%;
100
+
101
+ margin: 0 auto;
102
+
103
+ }
104
+
105
+ .img-list {
106
+
107
+ list-style: none;
108
+
109
+ display: grid;
110
+
111
+ justify-content: space-between;
112
+
113
+ grid-template-columns: 45vw 45vw;
114
+
115
+ padding-inline-start: 0px;/*ulの初期値リセット*/
116
+
117
+ }
118
+
119
+ .img-list__img {
120
+
121
+ box-sizing: border-box;
122
+
123
+ text-align: center;
124
+
125
+ }
126
+
127
+ .img-list__img img {
128
+
129
+ width: 44vw;
130
+
131
+ height: calc(44vw * 4 / 3);
132
+
133
+ }
134
+
135
+
136
+
137
+ @media screen and (min-width: 700px) {
138
+
139
+ .img-list {
140
+
141
+ grid-template-columns: 22vw 22vw 22vw 22vw;
142
+
143
+ }
144
+
145
+ .img-list__img img {
146
+
147
+ width: 22vw;
148
+
149
+ height: calc(22vw * 4 / 3);
150
+
151
+ }
152
+
153
+ }
154
+
155
+ ```

1

コード修正

2019/12/24 06:16

投稿

hatena19
hatena19

スコア33740

test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  }
50
50
 
51
- @media screen and (min-width: 700px) {
51
+ @media screen and (min-width: 700px) { .img-list::before{
52
52
 
53
53
  .img-list__img img {
54
54
 
@@ -57,6 +57,26 @@
57
57
  height: calc(22vw * 4 / 3);
58
58
 
59
59
  }
60
+
61
+ content:"";
62
+
63
+ display: block;
64
+
65
+ width: 22vw;
66
+
67
+ order:1;
68
+
69
+ }
70
+
71
+ .img-list::after{
72
+
73
+ content:"";
74
+
75
+ display: block;
76
+
77
+ width: 22vw;
78
+
79
+ }
60
80
 
61
81
  }
62
82