HTML Tutorial

The language for building web pages.

HTML Div

The HTML <div> Element

The <div> element is a block-level element often used as a container for other HTML elements. It has no required attributes, but style, class and id are common.

Why use div?

  • Group elements together for styling
  • Create layout sections
  • Apply CSS or JavaScript to a group of elements

When used together with CSS, the <div> element can be used to style blocks of content.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics