Image caption width to same as image

前端 未结 6 746
生来不讨喜
生来不讨喜 2020-12-25 13:16

How can I make image caption width same as image? Now I have the following code:

\"\" &
6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-25 13:55

    The only way to do captioning properly is to enclose the image and caption in a table constructed from span elements with table, table-row and table-cell css attributes.

    Any other method (including HTML5 figure tags) either gives width mismatches or causes unwanted line breaks.

    If your method must work in a non-css3 browser, then a table is probably the best bet.

提交回复
热议问题