Html 使用 html5 为图像添加标题的正确方法是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16605335/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:28:22  来源:igfitidea点击:

What is the correct way to add caption to an image using html5

csshtmlimagecaption

提问by Bradz

I am trying to work out the correct way to display a caption with an image, something like here makes sense jfiddle linkbut i am also looking at figure and figcaption which appears to serve the purpose better and I prefer ie:

我正在尝试找出显示带有图像的标题的正确方法,像这里这样的jfiddle link是有道理的,但我也在查看 figure 和 figcaption 这似乎更好地达到了目的,我更喜欢 ie:

<figure>
<img src="/animage.jpg" alt="an image">
<figcaption>This is the caption</figcaption>
</figure>

I am building a template for a blog news post so does either way matter or is there a correct use for figcaption that im missing?

我正在为博客新闻帖子构建模板,所以无论哪种方式都很重要,或者我缺少的 figcaption 是否有正确的用法?

采纳答案by Duncan Beattie

I would use the <figure>method as it has more semantic meaning than the div / span example.

我会使用该<figure>方法,因为它比 div / span 示例具有更多的语义含义。

http://jsfiddle.net/duncan/KYTWS/

http://jsfiddle.net/duncan/KYTWS/

related, although about blockquotes, http://alistapart.com/blog/post/more-thoughts-about-blockquotes-than-are-strictly-required

相关,虽然关于块引用,http://alistapart.com/blog/post/more-thoughts-about-blockquotes-than-are-strictly-required

回答by Sagar Shinde

I would also Suggest use element to show appropriate caption to Image. Click hereto see demo.

我还建议使用元素向图像显示适当的标题。单击此处查看演示。

For more options to add caption to image visit http://jkorpela.fi/www/captions.html

有关为图像添加标题的更多选项,请访问http://jkorpela.fi/www/captions.html