Skip to main content

When to Use the HTML5 'section' Element

The new HTML5 section element can be somewhat confusing. If you've been building ​HTML documents before HTML5, chances are you are already using the element to create structural divisions within your pages and then style the pages with them. So it might seem like a natural thing to simply replace your existing DIV elements with section elements. But this is technically incorrect.

The 'section' Element Is a Semantic Element

The SECTION element is a semantic element; it provides meaning to both user agents and humans about what the enclosed content is — specifically, a section of the document.

This may seem like a very general description, and that's because it is. There are other HTML5 elements that provide more semantic distinctions to your content that you should use first before you use the section element:

  • Article
  • Aside
  • Nav



























When to Use the 'section' Element

Use the article element when the content is an independent part of the site that can stand alone and be syndicated like an article or blog post. Use the aside element when the content is tangentially related to either the content of the page or the site itself, such as sidebars, annotations, footnotes, or associated site information. Use the nav element for content that supports site navigation.


The section element is a generic semantic element. Use it when none of the other semantic container elements are appropriate. It combines portions of your document into discrete units that you can describe as related in some way. If you can't describe the elements in the section in one or two sentences, then you probably shouldn't use the element.



Instead, you should use the DIV element. The DIV element in HTML5 is a non-semantic container element. If the content you are trying to combine doesn't have a semantic meaning, but you still need to combine it for styling, then the DIV element is the appropriate element to use.


How the 'section' Element Works

A section of your document can appear as the outer container for articles and aside elements. It can also contain content that isn't part of an article or aside. A section element can also be found inside an article, nav, or aside. You can even nest sections to indicate that one group of content is a section of another group of content that is a section of an article or the page as a whole.


The section element creates items inside an outline of the document. And as such, you should always have a header element (H1 through H6) as a part of the section. If you can't come up with a title for the section, the DIV element is probably more appropriate.


When Not to Use the 'section' Element

There is one purpose for which you should not use the section element: for style only.


In other words, if the only reason you're putting an element in that place is to attach CSS style properties, you should not use a section element. Find a semantic element or use the DIV element instead.


http://jl.kaoyanzhi.net/forum.php?mod=viewthread&tid=8325852&extra=page%3D1

http://jl.kaoyanzhi.net/forum.php?mod=viewthread&tid=6799269&extra=page%3D1

http://jl.kaoyanzhi.net/forum.php?mod=viewthread&tid=5937

http://heroicfantasygames.free.fr/Forum/viewtopic.php?p=28738

http://heroicfantasygames.free.fr/Forum/viewtopic.php?p=86269

http://jkm666.com/forum.php?mod=viewthread&tid=1605588

http://jkm666.com/forum.php?mod=viewthread&tid=250382

http://jkm666.com/forum.php?mod=viewthread&tid=227682

http://forum2.extremum.org/viewtopic.php?t=16069

http://forum2.extremum.org/viewtopic.php?t=39563

http://forum2.extremum.org/viewtopic.php?f=5&t=40550

http://www.99982296.com/viewthread.php?tid=295831&extra=page%3D1

http://www.99982296.com/viewthread.php?tid=234096&pid=324732&page=1&extra=

http://99982296.com/viewthread.php?tid=503383&extra=&frombbs=1

http://www.66682999.com/redirect.php?tid=209983&goto=lastpost

http://www.66682999.com/viewthread.php?tid=369172&extra=page%3D581&frombbs=1

http://www.66682999.com/redirect.php?tid=209982&goto=newpost


Ultimately It May Not Matter

A difficulty in writing semantic HTML is that what is semantic to the browser may be utter nonsense to you. If you feel that you can justify using the section element in your documents, then you should use it. Most user agents don't care and will display the page as you might expect whether you style a DIV or a section.


For designers who like to be semantically correct, using the section element in a semantically valid way is important. For designers who just want their pages to work, that isn't as important. Writing semantically valid HTML is good practice and keeps the pages more future-proofed. But in the end, it's up to you.

Comments

Popular posts from this blog

Complete SCCM 2309 Upgrade Guide

This article demonstrates how to perform the SCCM 2309 upgrade and lists all the new features added in Configuration Manager version 2309. The steps covered in this guide will help you upgrade your ConfigMgr environment in your production to version 2309. ConfigMgr 2309 is a production-ready release, and it is the second current branch release of 2023. ‘2309’ stands for the year 2023 and ’09’ for the month of September. Your SCCM site must be running version 2203 or later to install update 2309. The most recent fixes and new features are added to your site after you upgrade to SCCM current branch, version 2309. Microsoft has made available a brand-new SCCM current branch version 2309 for the year 2023. This update includes several new features and updates that were previously seen in the technical preview releases. The ConfigMgr update 2309 for the current branch is available as an in-console update. You can install SCCM update 2309 on sites that run version 2203 or later. Before the r...

Make Turkey Day Easy With Free Thanksgiving Templates for MS Word

Regardless of whether you're searching for an exquisite blowout or an agreeable, carefree Thanksgiving, these free Microsoft Word layouts can help with the readiness. visit here for more details : norton.com/setup These instant instruments can truly make all the difference with regards to solicitations, beautifications, menus, and that's only the tip of the iceberg. Step by step instructions to Get These Free Thanksgiving Templates  Dissimilar to different layouts that are accessible as downloads, these are open legitimately inside Microsoft Word. https://www.blackandbluedirectory.com/index.php?p=d https://www.blackandbluedirectory.com/index.php?p=d To discover these formats, open a clear or existing Word record, and after that go to File > New. From that point, look for the layout as depicted underneath, click it, and afterward select Create to open it in Word. click here : norton setup 01  Thanksgiving Cards Template for Invitations or Recipe Cards...

How to Find a Word in Word ?

incorporates a pursuit work that makes it simple to look for a wide range of components in an archive, including content. Utilize the fundamental instrument to search for cases of a particular word, or the propelled choices to do things like supplant all occasions of a word with another or look for conditions. https://kunwal.kinja.com/what-it-is-and-how-to-protect-yourself-against-it-1842324940?rev=1584161419440 https://www.techsite.io/p/1402148 NOTE:- Instructions in this article apply to Word 2019, 2016, 2013, 2010; Word for Office 365, and Word Online. visit here norton setup for more details. https://sites.google.com/site/viruscrime01/ https://www.reddit.com/user/miral016/comments/fid6hw/what_is_pharming_find_out_about_the_scam/ https://justpaste.it/6w9fg Play out a Basic Word Search  https://share.nuclino.com/p/Office-365-versus-Office-2019-Which-is-better-sBU4k3K9HjkKkLkTWkIyAN https://www.articleted.com/articles.php https://www.bloglovin.com/@monika6697/10-bes...