What’s Needed in the Head of a HTML Document?

View List on GitHub

This post will take less than a minute to read.

It’s hard to remember everything that should be included in the <head> of a HTML document. Old meta tags are sometimes phased out and new meta tags are sometimes introduced. The fact that nothing in the <head> element is actually shown to your site’s visitors—with the exception of the <title>—doesn’t help either.

As such, I’ve created a GitHub repository to track what I personally view as important inclusions in the <head> of a HTML document. Keep in mind that this is just a generic starting point and that you may need to add or remove tags depending on the project.

Do I even need the head element?

In HTML5 it’s actually okay to omit the <head> element; the following will validate:

<!doctype html>
<title>Page Title</title>

With that being said, it is still best practice to include both the <head> and <body> tags in a HTML document:

<!doctype html>
    <title>Page Title</title>

Tweet this