开发者

Why was the <hgroup> tag added to HTML5?

Why was the <hgroup> tag added to HTML5? What’s their technical usage? 开发者_运维问答What’s the grouping advantage?


It gives more defined selection, eg:

h1 {font-size:5em}                   output: font-size 5em
h2 {font-size:2em; color: black}     outout: font-size 2em, black

using them in a hgroup, you would get

hgroup h1 {font-size:3em}            output: font-size:3em
hgroup h2 {color:grey}               output: font-size:2em (from above defined), grey 


The problem with headers and their 'levels' arises when you generate dynamic content. Let's say you have a more or less fixed H1 and H2 combo and the page, and you have an article section with dynamic content that comes from a rich editor.

Traditionally it would be problematic at best to try and guess which header leveles to allow in the editor markup.

I haven't studied the hgroup element in detail, but I have read the article above and others, and it seems logical to me that the hgroup element can be used to 'reset' the level numbering, so that dynamic content in a rich editor can start using H1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜