如何使图像标题宽度与图像相同?现在我有以下代码:
<div class="image"> <img src="foo.jpg" alt="" /> <div>This is the caption.</div> </div>
我已经尝试了很多东西(浮动,绝对定位等),但如果标题很长,它总是使div宽而不是多行.问题是我不知道图像的宽度(或标题的长度).是解决这个使用表的唯一方法吗?
html css image caption width
caption ×1
css ×1
html ×1
image ×1
width ×1