Can you describe why hgroup was dropped and how the markup can be addressed today with an example?
Answer / chaitu
The hgroup element was introduced to group multiple heading elements (h1-h6) in order to avoid the creation of an unintended sublevel in the hierarchy. To understand what problem it tried to address, let’s consider the following markup:
<article>
<h1>Main title</h1>
<h2>This is a subtitle</h2>
<p>This is the content of this section</p>
</article>
Outlining the document hierarchy of the previous snippet gives us the following representation:
h1
|
---h2
|
p
This simple schema shows that the paragraph content of the snippet is seen as the content of the h2 instead of the h1, regardless if this was the intended behavior or not. So if the intention was simply to create a subheading and to associate the p with h1, the original markup was incorrect.
The hgroup element was introduced to address this issue with ease. Therefore, it was removed from the HTML5 specification in April 2013, due to lack of implementations and lack of use cases, making its use invalid.
A possible solution to create a subtitle so that the paragraph is associated to the h1 is shown below:
<article>
<h1>
Main title
<span>This is a subtitle</span>
</h1>
<p>This is the content of this section</p>
</article>
Is This Answer Correct ? | 0 Yes | 0 No |
How to create nest tables within tables in HTML?
What is the mark element? Can you describe an example of use for this element?
Explain marquee tag.
Is it possible to express a date range using a single time element?
What’s the difference between the meter element and the progress element?
Can you describe why hgroup was dropped and how the markup can be addressed today with an example?
How to create a button which acts like a link?
Consider the following markup: <figure> <picture> <source media="(min-width: 40em)" srcset="large.jpg 1024w, medium.jpg 640w, small.jpg 320y"> <img src="medium.jpg" alt="London by night"> </picture> <figcaption>A landscape of London by night</figcaption> </figure> Is it valid? If not, can you explain why?
What is the longdesc attribute? Can you explain its purpose?
Which network design layer provides a connection point for end user devices to the network? access core distribution networkby a networking device
Is the alt attribute mandatory on img elements? If not, can you describe a scenario where it can be set to an empty value? Does an empty value affect accessibility in any way?
How do I link to a location in the middle of an HTML document?