HTML Basics

Containing and header tags: div, span, h1 to h6


The following are HTML elements with their descriptions and default display value.

The <div> Element

  •  It is often used to contain other HTML elements and in defining a section of the HTML document.
  • It is a block element.
  • Enclose all contents of the <div> element with </div> .
  • It can be used to contain text or group together other HTML elements.
Click this to see sample code for div 

The <span> Element

  • It can also be used to contain other HTML elements and in defining a section of the HTML document.
  • It is an inline element.
  • Enclose all contents of the <span> element with </span>
  • It can be used to contain text or group together other HTML elements.

Click this to see sample code for span

HTML Headers <h1> to <h6>

  • Used for titles of new sections
  • <h1> is the largest in terms of font size and <h6> is the smallest.
  • Header tags are block elements.
  • Enclose all contents of the header tags with its corresponding closing tag.