0

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 Answers2

1

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.

Richard
  • 29,854
  • 11
  • 77
  • 120
0

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)

Community
  • 1
  • 1
Afzaal Ahmad Zeeshan
  • 15,669
  • 12
  • 55
  • 103