teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2019/10/01 02:47

投稿

kyoya0819
kyoya0819

スコア10434

answer CHANGED
@@ -78,6 +78,66 @@
78
78
  #b2 {
79
79
  position: absolute;
80
80
  top: 0;
81
+ z-index: 0
82
+ }
83
+ .boxa, .boxb {
84
+ text-align: center;
85
+ display: inline-block;
86
+ height: 20vh;
87
+ line-height: 20vh;
88
+ width: 25vw
89
+ }
90
+ .boxb {
91
+ height: 40vh
92
+ }
93
+
94
+ #box1 {
95
+ background: yellow
96
+ }
97
+ #box2 {
98
+ background: blue
99
+ }
100
+ #box3 {
101
+ background: green
102
+ }
103
+ #box4 {
104
+ background: skyblue
105
+ }
106
+ #box5 {
107
+ background: darkblue
108
+ }
109
+ #box6 {
110
+ background: pink
111
+ }
112
+ #box7 {
113
+ background: brown
114
+ }
115
+ ```
116
+ [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
117
+
118
+ まぁもっといい書き方は他にあると思いますはひらめきでふた通りの答えを出してみました。
119
+
120
+ ### 一番上にしない場合は
121
+
122
+ ```HTML
123
+ <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>
124
+ <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>
125
+ ```
126
+ ```CSS
127
+ * {
128
+ margin: 0;
129
+ padding: 0
130
+ }
131
+ #b1 {
132
+ position: relative;
133
+ top: 0;
134
+ display: inline-block;
135
+ margin-left: 12.5vw;
136
+ z-index: 100
137
+ }
138
+ #b2 {
139
+ position: relative;
140
+ top: -20vh;
81
141
  z-index: 0;
82
142
  }
83
143
  #b3 {
@@ -118,6 +178,5 @@
118
178
  background: brown
119
179
  }
120
180
  ```
121
- [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
122
181
 
123
- まぁもっといい書き方他にあると思ますはひらめきふた通りの答えを出してみました
182
+ 最後のサンプルないですが許してください

1

追記

2019/10/01 02:46

投稿

kyoya0819
kyoya0819

スコア10434

answer CHANGED
@@ -56,4 +56,68 @@
56
56
  background: brown
57
57
  }
58
58
  ```
59
- [サンプル](https://codepen.io/asuchi0819/pen/eYOaopM?editors=1100)
59
+ [サンプル](https://codepen.io/asuchi0819/pen/eYOaopM?editors=1100)
60
+
61
+ ### line-heightで閃いた。
62
+
63
+ ```HTML
64
+ <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>
65
+ <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>
66
+ ```
67
+ ```CSS
68
+ * {
69
+ margin: 0;
70
+ padding: 0
71
+ }
72
+ #b1 {
73
+ position: absolute;
74
+ display: inline-block;
75
+ margin-left: 12.5vw;
76
+ z-index: 100
77
+ }
78
+ #b2 {
79
+ position: absolute;
80
+ top: 0;
81
+ z-index: 0;
82
+ }
83
+ #b3 {
84
+ position: absolute;
85
+ top: 20vh;
86
+ z-index: 0;
87
+ }
88
+ .boxa, .boxb {
89
+ text-align: center;
90
+ display: inline-block;
91
+ height: 20vh;
92
+ line-height: 20vh;
93
+ width: 25vw
94
+ }
95
+ .boxb {
96
+ height: 40vh
97
+ }
98
+
99
+ #box1 {
100
+ background: yellow
101
+ }
102
+ #box2 {
103
+ background: blue
104
+ }
105
+ #box3 {
106
+ background: green
107
+ }
108
+ #box4 {
109
+ background: skyblue
110
+ }
111
+ #box5 {
112
+ background: darkblue
113
+ }
114
+ #box6 {
115
+ background: pink
116
+ }
117
+ #box7 {
118
+ background: brown
119
+ }
120
+ ```
121
+ [サンプル](https://codepen.io/asuchi0819/pen/LYPovLK?editors=1100#0)
122
+
123
+ まぁもっといい書き方は他にあると思いますはひらめきでふた通りの答えを出してみました。