or
, which is contained in which

前端 未结 4 816
一向
一向 2021-01-02 01:41

Trying to get my head around the new semantic elements in HTML5.

Does a

belong inside an
or is it the other
4条回答
  •  不思量自难忘°
    2021-01-02 02:13

    From the HTML5 spec:

    The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a header and possibly a footer.

    and

    The article element represents an independent section of a document, page, or site. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, or any other independent item of content.

    So I would say both section and article elements can contain the other element, if appropriate. I think your diagram makes sense, apart from the nested section elements:

    The section element is not a generic container element. When an element is needed for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead. A general rule is that the section element is appropriate only if the element's contents would be listed explicitly in the document's outline.

    Maybe use a

    for the outer one?

提交回复
热议问题