div Element

The <div> is a generic block-level container with no meaning of its own, used to group other elements together for styling or layout. It is one of the most-used HTML elements.

Web

Because a <div> starts on a new line and takes up the full available width, it is ideal for grouping sections of a page that you then position with CSS Grid or Flexbox.

Reach for a semantic element (like <section> or <nav>) when one fits the meaning; use a <div> when you just need a styling wrapper with no special meaning.

Examples

HTML

<div class="card">
  <h3>Title</h3>
  <p>Card content.</p>
</div>

Output:

Renders a block container grouping a heading and paragraph that can be styled as a card.

Learn it in a lesson

See also

Back to the Dictionary