html: head

What belongs in the <head> element

Perhaps read these first

You may find it helpful to read the following pages before this one.

  • html

The <head> element in HTML is where we take care of things such as:

This page provides a reference for some of the things you might see in the <head> section of a webpage.

<meta> tags

The <meta> tags often appear at the very top of a <head> element.

They are explained more at this page on W3Schools

’ for Setting the encoding

The bits that are used to represent your webpage are converted to characters according to some encoding. For example, 01000001 might represent the capital letter ‘A’.

It turns out that the encodings for the usual letters and digits used in English are pretty standard, once you start incuding symbols from other languages, special symbols, emojis, etc. issues of encoding can get really important.

We typically include this at the top of the <head> to indicate that our page is using utf-8 encoding, one of the most standard choices:

<meta charset="utf-8">

’ for the Viewport

As explained on this page from W3C Schools it is helpful to users of your web page that are on mobile devices (e.g. phones, tablets) if you define the viewport.

That code looks like this:

<meta name="viewport" content="width=device-width, initial-scale=1.0">