html - 在<article>中,<figure>在语义上可以放在&lt;header&gt;中吗?

标签 html semantic-markup

假设我有这个,

<article>
    <header>
        <h1>Article title</h1>
        <p>Article kicker</p>
        <figure>
            <img class="featured-image" src="http://article.com/featured/image.jpg">
        </figure>
    </header>
    <div class="content">
        <p>Bla bla</p>
        <p>Bla bla</p>
    </div>
    <footer>
        <p>About author</p>
    </footer>
</article>

<figure> 放在语义上是否正确里面<header>

规范定义 <figure>作为,

a unit of content, optionally with a caption, that is self-contained, that is typically referenced as a single unit from the main flow of the document

如果放在<header>里面这会使<figure>属于<article>的头而不是属于<article>本身?尝试环顾四周,但没有找到答案。

最佳答案

该图仍将是文章的一部分。它恰好位于文章标题中,如果您的图形实际上是文章标题的一部分而不是文章的主要内容,那就没问题。

如果您询问分段,<header><footer>不是剖面元素,因此该图仍将是文章大纲的一部分。即删除或注释掉 <header><footer>标签:

<article>
    <!-- header -->
        <h1>Article title</h1>
        <p>Article kicker</p>
        <figure>
            <img class="featured-image" src="http://article.com/featured/image.jpg">
        </figure>
    <!-- /header -->
    <div class="content">
        <p>Bla bla</p>
        <p>Bla bla</p>
    </div>
    <!-- footer -->
        <p>About author</p>
    <!-- /footer -->
</article>

结果相同。

关于html - 在<article>中,<figure>在语义上可以放在&lt;header&gt;中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41326740/

相关文章:

css - HTML5中一个div向左浮动,两个div向右浮动

algorithm - 在哪些现实场景中语义数据库比关系数据库更好?

html - 如何在不同分辨率下保留所有元素 - HTML/CSS3

html - Google 'understand' 微格式是否对我的 SEO 有帮助?

css - W3C 的 "Semantic Data Extractor"在语义正确的 XHTML CSS 开发中有什么用处?

css - 使用 section 元素进行样式布局和包装

java - 用于 html5 音频和视频的volumeslider

html - 如何更改悬停框中的图像

javascript - Cordova Android 禁用后退按钮 [不起作用]

html - 居中 div 元素而不考虑文本对齐方式