https://faylette.github.io/3-column-preview-card-component-main/
我正在研究这个并尝试将边框半径应用于包含元素,它确实出现了,但只有当元素接触浏览器的边缘时才会出现。无论 flex-direction 是行还是列,都会发生这种情况。
这是相关的CSS代码。
/* contains each of the containers (car cards) */
.content {
display: flex;
overflow: hidden;
border-radius: 10px;
}
/* each car card */
.container {
width: 350px;
padding: 40px;
}
div#sedans {
background-color: hsl(31, 77%, 52%);
}
div#suvs {
background-color: hsl(184, 100%, 22%);
}
div#luxury {
background-color: hsl(179, 100%, 13%);
}
@media (max-width: 600px) {
.content {
flex-direction: column;
width: 500px;
}
}
<div class="content">
<div class="container" id="sedans">
<img src="images/icon-sedans.svg">
<h2>Sedans</h2>
<p>
Choose a sedan for its affordability and excellent fuel economy. Ideal for cruising in the city
or on your next road trip.
</p>
<button class="btn1">Learn More</button>
</div>
<div class="container" id="suvs">
<img src="images/icon-suvs.svg">
<h2>SUVs</h2>
<p>
Take an SUV for its spacious interior, power, and versatility. Perfect for your next family vacation
and off-road adventures.
</p>
<button class="btn2">Learn More</button>
</div>
<div class="container" id="luxury">
<img src="images/icon-luxury.svg">
<h2>Luxury</h2>
<p>
Cruise in the best car brands without the bloated prices. Enjoy the enhanced comfort of a luxury
rental and arrive in style.
</p>
<button class="btn3">Learn More</button>
</div>
</div>
请让我知道如何解决这个问题,因为这是我在 Stack Overflow 上的第一篇文章,如果我在问这个问题时做错了什么。谢谢!