什么HTML元素应该用于图像下的标签/标题? [英] What HTML element should be used for a label / title under images?

查看:139
本文介绍了什么HTML元素应该用于图像下的标签/标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我应该使用< p>如果我有一排图片,每张图片都应该有一个简短的标签或标题。 ; h3> 或只是< div> 或其他标签或标题?



例如:

 < ul> 
< li>
< img ...>
< h3>铁人< / h3>
< / li>
< li> ...
< / li>
< / ul>

它实际上取决于3种情况:


  1. 如果标题是针对此页面的内容(例如鸟类及其学术名称的图片,如麻雀和雀科),那么< h3> 可能更有意义?或

  2. 如果它只是一款游戏的标题,那么它可能是铁人,hello kitty,bug bunny等,所以它确实并不意味着页面的真实内容,而只是用于游戏的一些名字,那么< div> 会更合适,或者< h3> ,因为它们实际上代表了游戏主题的有意义的名字?

(或者除了< h3> < div>

解决方案

我建议使用< figure> < figcaption> 元素:

  <李> 
< figure>
< img src =.../>
< figcaption>
< h3>图像标题< / h3>
< p>一些文字来描述图片< / p>
< / figcaption>
< / figure>
< / li>

但这是令人难以置信的主观。

参考文献:




Let's say I have a row of images, and each image should have a short label or title under it.

Should I use <h3> or just <div> or something else for that label or title?

For example:

<ul>
    <li>
        <img ...>
        <h3>Iron Man</h3>
    </li>
    <li> ... 
    </li>
</ul>

Would it actually depends on 3 cases, that,

  1. what if the title is for the content of this page (such as pictures of birds and their academic names, such as "sparrow" and "finch"), then <h3> could make more sense? or

  2. what if it is just titles for a game, so it can be "iron man", "hello kitty", "bugs bunny", etc, so that it really doesn't mean real content for the page but rather just some names used for the game, then <div> will be more suitable, or

  3. if the games is for "hello kitty", "pochacco", "keroppi", so that they are all characters of Sanrio, then it actually is more semantically correct to use <h3> because they actually denote meaningful names for the theme of the game?

(or besides <h3> and <div>, would it be more semantically correct to use other tags?)

解决方案

I'd suggest using <figure> and <figcaption> elements:

<li>
    <figure>
        <img src="…" />
        <figcaption>
            <h3>Image Title</h3>
            <p>some text to describe the image</p>
        </figcaption>
    </figure>
</li>

But this is, incredibly subjective.

References:

这篇关于什么HTML元素应该用于图像下的标签/标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆