<hgroup> for header grouping

The hgroup element treats multiple header elements as a single item.

 
<!DOCTYPE HTML> 
<html> 
<head> 
<title>Example</title> 
<style> 
hgroup > h1 { margin-bottom: 0px;} 
hgroup > h2 { 
   background: grey; 
   color: white; 
   font-size: 1em; 
   margin-top: 0px; 
} 
</style> 
</head> 
<body> 
    <hgroup> 
        <h1>H1 in group</h1> 
        <h2>H2 in group</h2> 
    </hgroup> 
    <h1>H1 outside the group</h1> 
    <h2>H2 outside the group</h2> 
    <h3>H3 outside the group</h3> 
</body> 
</html>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

Related: