What's the difference between <div> and <section>? As I know the section has a "value" and the div does not, but what does that mean?

I mean, based on my research, I know it acts the same way, except that the section makes sense and the div doesn't. What exactly does this mean? Will using a section render it differently in the browser than using a div? I am just trying to visualize the difference. Please don't googled me any answers because I searched for it and still don't understand it 100%. Is this just for readability? Thanks to

+3


source to share


2 answers


Good explanation of the W3 wiki section:

An element <section>

represents a general section of a document or application.

  • A section in this context is a thematic grouping of content:
    • chapter
    • various tabs in a tabbed dialog
    • numbered sections of the thesis ...
  • The website home page can be divided into sections for introduction, news, and contact information.
  • The section item is not a common container item. A section element is only suitable if the content will be explicitly indicated in the outline document. [Example A]
  • Usually a section with a title.


The tag <div>

should be used as a generic container for the flow. The specification defined the allowed content:

http://www.w3.org/TR/html-markup/terminology.html#flow-content

+1


source


They won't make any difference in terms of output, the point of using sections over divs is to increase the semantic meaning in your code or other words to make it clearer later when you or others are back and trying to figure out what it does.



0


source







All Articles