Jacob Paris
← Back to all content

Optional closing elements in HTML

Several HTML elements do not require closing tags

  • <html>
  • <head>
  • <body>
  • <p>
  • <dt>
  • <dd>
  • <li>
  • <option>
  • <th>
  • <tbody>
  • <tr>
  • <td>
  • <tfoot>
  • <colgroup>

That means that this is valid html

<html>
<head>
<title>My blog</title>
<body>
<h1>My blog</h1>
<p>Welcome to my blog</p>
<p>Here are a list of my posts</p>
<ul>
<li>My first post</li>
<li>My second post</li>
<li>My third post</li>
</ul>
</body>
</head>
</html>

As a general rule I don't recommend writing html like this, as it can be hard to tell when an element is meant to end or meant to nest, especially when the formatting isn't as clean as possible.

Professional headshot

Hi, I'm Jacob

Hey there! I'm a developer, designer, and digital nomad with a background in lean manufacturing.

About once per month, I send an email with new guides, new blog posts, and sneak peeks of what's coming next.

Everyone who subscribes gets access to the source code for this website and every example project for all my tutorials.

Stay up to date with everything I'm working on by entering your email below.

Unsubscribe at any time.