← Back to Blog

Optional closing elements

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

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

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.