15 useful HTML elements

Most elements have an opening and closing tag. The img and br elements are exceptions and do not wrap content.

ElementWhat it doesExample
<html>Wraps the whole HTML document.<html lang="en"> ... </html>
<head>Holds page information not shown as page content.<head> ... </head>
<title>Sets the browser tab title inside head.<title>My Page</title>
<body>Contains the content shown on the page.<body> ... </body>
<h1>The main heading of a page.<h1>Page Title</h1>
<h2>A section heading below the main heading.<h2>Section</h2>
<p>A paragraph of text.<p>Hello there.</p>
<a>Creates a link using its href attribute.<a href="about.html">About</a>
<img>Displays an image; include useful alt text.<img src="cat.jpg" alt="A gray cat">
<ul>Starts a bulleted list.<ul> ... </ul>
<ol>Starts a numbered list.<ol> ... </ol>
<li>A list item inside ul or ol.<li>First item</li>
<strong>Marks text as strongly important.<strong>Important</strong>
<br>Adds a line break within text; use sparingly.Line one<br>Line two
<button>Creates a button control.<button type="button">Start</button>

Putting elements together

<h1>Planets</h1>
<p>Our solar system has eight planets.</p>
<ul>
  <li>Earth</li>
  <li>Mars</li>
</ul>

Learn more