I've been learning HTML now and I came across two elements with the exact same definition. I want to know what is the difference between the SECTION element and the DIV element.
2 Answers
SECTION is semantic markup - it has meaning. You are meant to use it to hold a section of a page. Other semantic markup tags include <header>, <footer>, <nav> and <aside>
A DIV is purely a structural element - it has no implied meaning about what its content is meant to be.
You can style a section using CSS to do whatever you like.
- 29,854
- 11
- 77
- 120
Answer to the question
The section element is a section of the document! Whereas div is a container for the elements and to be noted div doesnot have any actual meaning in the document.
section usage is prohibited if needs to be used a container for the content.
When developer requires to edit or style the document, they are required to be using the div tag and not the section element.
For more
Read the following links to understand more about them.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section (Section)
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div (Div)
- 1
- 1
- 15,669
- 12
- 55
- 103