挑战:
显示一系列可以相互重叠的水平卡片,即使
利用 Flexbox,我们可以通过将卡片包装在溢出控制的容器中来创建重叠的卡片:
<code class="css">.cards { display: flex; align-content: center; max-width: 35em; } .cardWrapper { overflow: hidden; } .cardWrapper:last-child, .cardWrapper:hover { overflow: visible; } .card { width: 10em; min-width: 10em; height: 6em; border-radius: 0.5em; border: solid #666 1px; background-color: #ccc; padding: 0.25em; display: flex; flex-direction: column; justify-content: center; align-items: center; }</code>
<code class="html"><div class="cards"> <div class="cardWrapper"> <div class="card">card 1 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 2 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 3 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 4 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 5 blah blah blah</div> </div> </div></code>
以上是如何在水平系列中实现重叠的 Flex 项目?的详细内容。更多信息请关注PHP中文网其他相关文章!