What is the difference between div and section in HTML?

<div> is a generic container with no meaning. It is used when you only need a box for styling or layout. <section> is a semantic element for a group of related content, like a chapter, and it should normally have a heading.

<section>
  <h2>Our Services</h2>
  <div class="card">Web design</div>
  <div class="card">SEO</div>
</section>

Use section when the content makes a real topic block. Use div for the small styling wrappers inside it. See semantic elements and div and span.


Learn more about the similar topics:
Tutorials
HTML Semantic Elements
HTML Responsive Design
Exercises & Assignments
Write an HTML program to create a navigation menu
Write an HTML program to create a page layout with semantic elements
Interview Questions & Answers
What are semantic elements in HTML5? Give examples
What is the difference between div and section in HTML?
How do you make a web page responsive using HTML and CSS?
What is web accessibility and how does HTML help with it?