> For the complete documentation index, see [llms.txt](https://web-dev-guide.wishtack.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://web-dev-guide.wishtack.io/html/empty-tags-vs-content-tags.md).

# Empty Tags vs Content Tags

Some tags like `div`, `span` and `p` need content.

{% hint style="warning" %}
Do not mix text with tags inside a content tag.

Otherwise, formatting and dynamic content modification can get complicated.

```markup
<!-- Dirty! -->
<div>
    Hello
    <span>Mr Foo</span>
</div>


<!-- Clean. -->
<div>
    <span>Hello</span>
    <span>Mr Foo</span>
</div>
```

{% endhint %}

With HTML5, empty tags don't need to be closed.

The following examples are equivalent:

```markup
<!-- Auto-closing tag. -->
<input type="text"/>

<!-- Implicit auto-closing tag. -->
<input type="text">
```

Closing empty tags might seem cleaner but it is better to leave them open.

{% hint style="warning" %}
Auto-closing tags might be ignored by some browsers and can cause trouble.
{% endhint %}
