div element has no special meaning. It is often used as a block of children elements.section element introduced in HTML5 standard is used to group related elements, such as a subsection of a long article.section element provides more semantic syntax than the div element.div has its own constructor interface HTMLDivElement.section and other HTML5 elements such as article, footer, header, main, navbar do not have this. In fact, their constructors are from HTMLElement.<div id="root"><header></header><section></section><div></div><footer></footer></div>
document.getElementById('root').querySelectorAll('*').forEach((e) => console.log(e.tagName, ':', e.constructor.name));// HEADER: HTMLElement// SECTION: HTMLElement// DIV: HTMLDivElement// FOOTER: HTMLElement
sections, then the h1 elements of the inner sections will have smaller font-sizez than the h1 elements of the outer sections.<section><h1>Heading</h1><section><h1>Heading of inner section</h1></section></section>
h1 at different levels of section:/* First level */:-webkit-any(article, aside, nav, section) h1 {font-size: 1.5em;}/* Second level */:-webkit-any(article, aside, nav, section) :-webkit-any(article, aside, nav, section) h1 {font-size: 1.17em;}/* Third level */:-webkit-any(article, aside, nav, section):-webkit-any(article, aside, nav, section):-webkit-any(article, aside, nav, section)h1 {font-size: 1em;}/* Fourth level */:-webkit-any(article, aside, nav, section):-webkit-any(article, aside, nav, section):-webkit-any(article, aside, nav, section):-webkit-any(article, aside, nav, section)h1 {font-size: 0.83em;}
div elements. All the h1 elements will have the same font size no matter how their div containers are structured.section elements are often used to build the outlines of the page.
We should use the heading elements (h1 - h6) inside section to indicate the summary of section.<section><h2>This section tells about</h2></section><section><h2>Title of another section</h2></section>
display: inline, hence we need to reset the value for HTML5 elements:article,aside,footer,header,nav,section {display: block;}
/* Render the `main` element consistently in IE */main {display: block;}/* Add the correct display in Edge, IE 10+, and Firefox */details {display: block;}
<!--[if lt IE 9]><script>document.createElement("article");document.createElement("aside");document.createElement("footer");document.createElement("header");document.createElement("nav");document.createElement("section");</script><![endif]-->