HTML5,< section>内部无序列表 [英] HTML5, <section> inside unordered list
问题描述
我可以在无序列表中使用<section>
标签吗?
Can I use <section>
tag inside unordered list?
我知道,<section>
代表文档的一般部分.通常我们在里面找到标题.
I know, that <section>
represent a generic section of document. Usually we find heading inside.
所以...我有产品列表.通常每页约20个.每个元素都有:
So... I have list of products. Usually about 20 per page. Each element have:
-
标题
heading,
简短说明(最多255个字符),
short description (max 255 chars),
缩略图,一些详细信息,按钮.
thumbnail, some details, button.
因此,每个列表项都类似于部分"is a thematic grouping of content, typically with a heading"
.
So each list item is something like section, "is a thematic grouping of content, typically with a heading"
.
我当然不使用<section>
来达到样式目的.
Of course I don't use, <section>
to styling purpose.
我认为,<section>
在这里也可以是列表的包装,以及列表<article>
的每个元素.
I think, <section>
also could be here a wrapper for a list, and each element of list <article>
.
您对此有何看法?
推荐答案
在<li>
标记内使用<section>
标记可验证(您可以使用 http://dev. w3.org/html5/spec-author-view/the-section-element.html#the-section-element ),对我来说似乎很好.
Using a <section>
tag inside an <li>
tag validates (you can try this using the "Text Field" option on http://html5.validator.nu/), and the spec doesn’t seem to suggest you shouldn’t use it in this way (see http://dev.w3.org/html5/spec-author-view/the-section-element.html#the-section-element), so that seems fine to me.
<article>
标签用于.我从来没有完全弄清楚这是什么意思,而不是在单个页面上列出几篇博客文章,但是我认为产品摘要听起来也很合适.因此,关于包含整个列表的<section>
和每个产品的<article>
的第二个想法可能听起来最好.
The <article>
tag is meant for "self-contained compositions". I’ve never been entirely clear what that means outside of several blog posts being listed on a single page, but I think product summaries sound like a decent fit for that too. So your second idea of a <section>
containing the entire list, and an <article>
for each product, probably sounds best.
这篇关于HTML5,< section>内部无序列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!