0

What is the difference between the <div> and <section> tags?

Hello fellow programmers. I recently started the HTML5 module of the HTML tutorial, and there is a chart in one of the lessons that shows that <section> tags are used to divide up parts of the <article> tag's content. Does this mean that it works the same way as <div> tags in the <body>, or can <section> and <div> tags be used interchangeably, or neither? Basically, I would like to know more about the <section> tag.

8th Feb 2017, 7:31 PM
Delaina Hardwick
Delaina Hardwick - avatar
2 Respuestas
+ 4
First things first, <section> tag has a semantic meaning unlike <div>. semantic tags describe their meaning both to the developer and the browser. Basically, the <section> tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document. divs, on the other hand, have no meaning, typically used for grouping elements and styling them via CSS. for more info about <section> tag. ---> http://www.w3schools.com/tags/tag_section.asp for more info about <div> tag --> http://www.w3schools.com/tags/tag_div.asp
8th Feb 2017, 8:10 PM
Ousmane Diaw
+ 2
Yes, section works the same way as div. Section, and the other semantic elements, were introduced to give the code and structure of a document more meaning (semantic). Before they were introduced, divs were used for everything, all the time, to wrap content (and still is by a lot of developers).
8th Feb 2017, 8:06 PM
Kristoffer Andersson
Kristoffer Andersson - avatar