我被一些css卡住了,需要你的帮助。我需要达到图像上显示的效果。现在的问题是布局的响应性,我希望当浏览器的大小改变时,这些tiles会改变它们的大小,并在移动设备上一个接一个地显示它们。我在这里尝试了flexbox,但在我想要达到的效果上有一些问题。

下面是我的html:
<section class="tiles">
<div class="first-tile">
<div class="tile-img">
<img src="./assets/tile-img.webp" alt="image">
</div>
<div class="tile-content">
<h5>Lorem Ipsum</h4>
<p>Lorem Ipsum</p>
</div>
</div>
<div class="side-tiles">
<div class="second-tile">
<h5>Lorem Ipsum</h4>
<p>Lorem Ipsum</p>
</div>
<div class="third-tile">
<h5>Lorem Ipsum</h4>
<p>Lorem Ipsum</p>
</div>
</div>
</section>发布于 2021-06-09 23:50:33
您可以使用display:grid
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 100px 100px;
grid-gap: 10px;
}
.bloc {
background-color: red;
height: 100%;
width: 100%;
}
.bloc:nth-child(1) {
grid-row: span 2;
display: flex;
justify-content: center;
align-items: center;
}
img {
max-width: 230px;
max-height: 95px;
width: auto;
height: auto;
}<div class="grid">
<div class="bloc">
<img src="https://images.unsplash.com/photo-1620654458802-d9392aa95664?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyMzI1MzM0NA&ixlib=rb-1.2.1&q=85" alt="">
<div class="text">
<h4> Lorem</h4>
<p>Lorem</p>
</div>
</div>
<div class="bloc"></div>
<div class="bloc"></div>
</div>
https://stackoverflow.com/questions/67907400
复制相似问题