回答編集履歴

2

追記

2019/10/01 02:47

投稿

kyoya0819
kyoya0819

スコア10429

test CHANGED
@@ -158,6 +158,126 @@
158
158
 
159
159
  top: 0;
160
160
 
161
+ z-index: 0
162
+
163
+ }
164
+
165
+ .boxa, .boxb {
166
+
167
+ text-align: center;
168
+
169
+ display: inline-block;
170
+
171
+ height: 20vh;
172
+
173
+ line-height: 20vh;
174
+
175
+ width: 25vw
176
+
177
+ }
178
+
179
+ .boxb {
180
+
181
+ height: 40vh
182
+
183
+ }
184
+
185
+
186
+
187
+ #box1 {
188
+
189
+ background: yellow
190
+
191
+ }
192
+
193
+ #box2 {
194
+
195
+ background: blue
196
+
197
+ }
198
+
199
+ #box3 {
200
+
201
+ background: green
202
+
203
+ }
204
+
205
+ #box4 {
206
+
207
+ background: skyblue
208
+
209
+ }
210
+
211
+ #box5 {
212
+
213
+ background: darkblue
214
+
215
+ }
216
+
217
+ #box6 {
218
+
219
+ background: pink
220
+
221
+ }
222
+
223
+ #box7 {
224
+
225
+ background: brown
226
+
227
+ }
228
+
229
+ ```
230
+
231
+ [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
232
+
233
+
234
+
235
+ まぁもっといい書き方は他にあると思いますはひらめきでふた通りの答えを出してみました。
236
+
237
+
238
+
239
+ ### 一番上にしない場合は
240
+
241
+
242
+
243
+ ```HTML
244
+
245
+ <div id=b1><div id=box1 class=boxa>box1</div><div id=box2 class=boxa>box2</div><div id=box3 class=boxa>box3</div></div>
246
+
247
+ <div id=b2><div id=box4 class=boxb><br>box4</div><div id=box5 class=boxb><br>box5</div><div id=box6 class=boxb><br>box6</div><div id=box7 class=boxb><br>box7</div></div>
248
+
249
+ ```
250
+
251
+ ```CSS
252
+
253
+ * {
254
+
255
+ margin: 0;
256
+
257
+ padding: 0
258
+
259
+ }
260
+
261
+ #b1 {
262
+
263
+ position: relative;
264
+
265
+ top: 0;
266
+
267
+ display: inline-block;
268
+
269
+ margin-left: 12.5vw;
270
+
271
+ z-index: 100
272
+
273
+ }
274
+
275
+ #b2 {
276
+
277
+ position: relative;
278
+
279
+ top: -20vh;
280
+
161
281
  z-index: 0;
162
282
 
163
283
  }
@@ -238,8 +358,6 @@
238
358
 
239
359
  ```
240
360
 
241
- [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
361
+
242
-
243
-
244
-
362
+
245
- まぁもっといい書き方他にあると思はひらめきでふた通りの答えを出してみました
363
+ 最後のサンプルなが許してください

1

追記

2019/10/01 02:46

投稿

kyoya0819
kyoya0819

スコア10429

test CHANGED
@@ -115,3 +115,131 @@
115
115
  ```
116
116
 
117
117
  [サンプル](https://codepen.io/asuchi0819/pen/eYOaopM?editors=1100)
118
+
119
+
120
+
121
+ ### line-heightで閃いた。
122
+
123
+
124
+
125
+ ```HTML
126
+
127
+ <div id=b1><div id=box1 class=boxa>box1</div><div id=box2 class=boxa>box2</div><div id=box3 class=boxa>box3</div></div>
128
+
129
+ <div id=b2><div id=box4 class=boxb><br>box4</div><div id=box5 class=boxb><br>box5</div><div id=box6 class=boxb><br>box6</div><div id=box7 class=boxb><br>box7</div></div>
130
+
131
+ ```
132
+
133
+ ```CSS
134
+
135
+ * {
136
+
137
+ margin: 0;
138
+
139
+ padding: 0
140
+
141
+ }
142
+
143
+ #b1 {
144
+
145
+ position: absolute;
146
+
147
+ display: inline-block;
148
+
149
+ margin-left: 12.5vw;
150
+
151
+ z-index: 100
152
+
153
+ }
154
+
155
+ #b2 {
156
+
157
+ position: absolute;
158
+
159
+ top: 0;
160
+
161
+ z-index: 0;
162
+
163
+ }
164
+
165
+ #b3 {
166
+
167
+ position: absolute;
168
+
169
+ top: 20vh;
170
+
171
+ z-index: 0;
172
+
173
+ }
174
+
175
+ .boxa, .boxb {
176
+
177
+ text-align: center;
178
+
179
+ display: inline-block;
180
+
181
+ height: 20vh;
182
+
183
+ line-height: 20vh;
184
+
185
+ width: 25vw
186
+
187
+ }
188
+
189
+ .boxb {
190
+
191
+ height: 40vh
192
+
193
+ }
194
+
195
+
196
+
197
+ #box1 {
198
+
199
+ background: yellow
200
+
201
+ }
202
+
203
+ #box2 {
204
+
205
+ background: blue
206
+
207
+ }
208
+
209
+ #box3 {
210
+
211
+ background: green
212
+
213
+ }
214
+
215
+ #box4 {
216
+
217
+ background: skyblue
218
+
219
+ }
220
+
221
+ #box5 {
222
+
223
+ background: darkblue
224
+
225
+ }
226
+
227
+ #box6 {
228
+
229
+ background: pink
230
+
231
+ }
232
+
233
+ #box7 {
234
+
235
+ background: brown
236
+
237
+ }
238
+
239
+ ```
240
+
241
+ [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
242
+
243
+
244
+
245
+ まぁもっといい書き方は他にあると思いますはひらめきでふた通りの答えを出してみました。