HTML结构:
<div class="parent">
<div class="second"></div>
<div class="third">
<div class="fourth"></div>
<div class="fifth">
<div class="sixth"></div>
<div class="seventh"></div>
</div>
</div>
</div>
在4x4(4行x 4列)的网格上,我想创建一个网格,其中:
.second is on 1x1 , 1x2 , 2x1, 2x2 position
.fourth is on 1x3 , 1x4 , 2x3, 2x4 position
.fifth is on 3x1, 3x2 , 3x3, 3x4, 4x1, 4x2 , 4x3, 4x4 position
.sixth is on 3x1, 3x2, 3x3, 3x4 position
.seventh is on 4x3, 4x4 position
所以我可以得到这样的东西:
.div1 in the image is .second
.div2 in the image is .fourth
.div3 in the image is .sixth
.div4 in the image is .seventh
这是否可能与网格或flexbox?
1条答案
按热度按时间cyvaqqii1#
你可以通过显示.third来让它被网格放置“忽略”:内容。它的直接子项,而不是它,然后被考虑放置在网格中。
然后,为了得到.fifth的孩子,你需要让.fifth本身成为一个网格。