我想使图形标签的边框适合 img。
这是html结构:
<div class="container">
<figure>
<img src="" alt="">
<figcaption></figcaption>
</figure>
</div>
这是CSS:
figure {
border: 1px solid $color-light-gray;
padding: 5px;
img {
max-width: 100%;
height: 100%
}
figcaption {
text-align: center;
}
}
最佳答案
在图中使用display:table
,在figcaption
中使用display:table-caption
关于css - 将 <figcaption> 缩小到兄弟 <img> 并保持响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52822338/