HTMLHTML12 min read

HTML Div

Use div as a box/container to group content for layout and styling.

David Miller
December 22, 2025
5.0k166

div is a container (a box). It helps you group elements.

Example

<div style="border: 1px solid #ccc; padding: 10px;">
  <h2>Card Title</h2>
  <p>This is inside a div box.</p>
</div>

Preview

A box appears with title and paragraph inside.

When you use div

  • grouping sections
  • making layout blocks
  • applying CSS to a group
#HTML#Beginner