Head

Form

Lower Head

EBLOG

E-Marketing Performance Blog

Declare the Doctype of Each Web Page

declare doctype

HTML is a pretty simple markup language, but as most languages go, it has evolved over time. Think of the different versions of HTML as different dialects of the same language.

I’m reading a book about ancient biblical and extra-biblical texts. The author is taking the reader through the story of finding the Dead Sea Scrolls. While the scrolls were written in Hebrew, they were written in an early version of Hebrew.

In order to properly translate the documents, scholars had to have an understanding of how that early version of Hebrew worked and how it differs from Hebrew today. If translators tried to use modern Hebrew to translate these ancient texts, it would be wrong. Very, very wrong.

HTML is no different.

Every web page is a document that must be translated by a web browser. But before a browser can begin to translate the HTML, it has to know which dialect, or version, is being used. If it assumes the wrong dialect, the page will not appear to the visitor as you want it to, depending on the browser they are using.

There is a simple way to gain control of your visual message: Add a Document Type Definition (DTD), otherwise known as doctype, to your HTML code.

A doctype is a simple line of code you add at the top of each page that lets the browser (or search engine) know how to properly translate the page. The doctypes for older versions of HTML were somewhat complex. However for HTML5, they’ve made it quite simple. It looks like this:

<DOCTYPE html>

But just as with ancient biblical manuscripts, using a current doctype on a page with old code is a recipe for major mistranslation. Make sure you both declare your doctype and that it’s correct for the HTML language your pages use. This will ensure your web pages look to your visitors the way you already think it does.

Comments are closed.