我有这个:
figure {
display:inline-block;
}
figcaption {
width:0;
min-width:100%;
}
<figure>
<img src="https://i.imgur.com/k1Crowy.jpg" width="200">
<figcaption> This is some random text that should not expand the figure tag beyond the width of the img tag </figcaption>
</figure>
如何将<figure>
标签居中对齐,不破坏figcaption
宽度的设置且不添加外部div?
我尝试过的方法
我可以对子标签使用margin:0 auto
的方法,但这会破坏figcaption
宽度的设置。