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 |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |