Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Difference between div tag and section tag in html and their use with examples and which is better to use and why
Posted

1 solution

Here is what spec says:
http://www.w3.org/html/wg/drafts/html/master/semantics.html#the-section-element[^]

My opinion is that it is more about semantic side of your page. When you for example have a newspaper website or blog, you have strictly defined layout. And instead of using
you will use article tag. But nobody forces you to do it. You page will work exactly the same with div and with article.

So as I said it is more about semantic and maybe in a future the search engines will give you some plus points for using this and maybe not :).

here is a very good article about this topic too:

http://html5doctor.com/the-section-element/[^]

if you dont want to read it all best part is I think this:


Rules of thumb for using section

Of course, there are always exceptions, but these should give useful guidance for 99% of cases:

Don't use it just as hook for styling or scripting; that's a div
Don't use it if article, aside or nav is more appropriate
Don't use it unless there is naturally a heading at the start of the section
The revised spec (as of 16 September) says:
Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the element.
As blogposts and comments are often syndicated (by being pulled into other blogs or being linked via twitter, reddit etc) they should be articles.
 
Share this answer
 
v2
Comments
Shmuel Zang 29-Jun-15 4:26am    
5'ed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900