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
<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
Moulton
Moulton

Hey there! I'm a developer, designer, and digital nomad building cool things with Remix, and I'm also writing Moulton, the Remix Community Newsletter

About once per month, I send an email with:

  • New guides and tutorials
  • Upcoming talks, meetups, and events
  • Cool new libraries and packages
  • What's new in the latest versions of Remix

Stay up to date with everything in the Remix community by entering your email below.

Unsubscribe at any time.