Freeola Home Get Dotted Domains Win Free Games Freeola Blog Freeola Guides Freeola Customer Forum
get Any UK domain name
just 49p for 1 year!

Freeola Guides


Doctypes - An Introduction

By Freeola Support on 20th December, 2017 | 0 Comment(s)

When writing the HTML for a website, there are various different markup standards that you may choose to use depending on the requirements of your pages. A Doctype (Document Type Declaration) is the way that you as the designer tell the web browser interpreting your page which of these standards you wish to follow. If a Doctype is not specified, the browser can often mis-interpret your website causing some elements to be mis-aligned and mis-sized.

 

Some common Doctypes that you may wish to use are as follows:

 

HTML 5

 

<!DOCTYPE html> 

If you are creating your website using the recent HTML5 web standards, only this short Doctype is required and allows you to use all of the newer features, limited only by what is supported by the viewer's browser. Currently, support for HTML5 is fairly limited, however this is likely to increase over time.

 

HTML 4.01 Strict

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

This Doctype tells the browser to follow the HTML 4 standard without allowing for older deprecated element types. Framesets are also not allowed.

 

HTML 4.01 Transitional

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Using transitional will allow for older HTML tags to be used and displayed correctly on the page. This may be useful when using pages that have not yet been updated to the newer standards. This Doctype however does not allow framesets.

 

HTML 4.01 Frameset

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

As the name suggests, this Doctype allows for framesets, as well as the older tags allowed by the Transitional Doctype.

 

Adding a Doctype

 

A Doctype is placed at the very top of your HTML text in your HTML file before the opening HTML tag. A short example of a HTML page using a Doctype may be as follows.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<div style="margin:auto;width:500px">
<h1>Doctype Sample</h1>
<p>This page uses a strict Doctype</p>
</div>
</body>
</html> 

This tells web browsers to read the page as strict HTML 4.01. Without the Doctype declaration, some browsers may fail to interpret the page as expected and not adjust the margins correctly.


Did you find this article helpful?

Yes | No


Article Comments (0)
There are currently no comments on this article.
Add your comment:

Comments are limited to 750 characters, you have 750 remaining.

Freeola & GetDotted are rated

Check out some of our customer testimonials below:

Well done Freeola!
Just to say thanks guys. Very impressed with your support service. I have only had to contact you twice and both times it has been quick and efficient. I dont usually email...

View More Testimonials

Many thanks!!
Registered my website with Freeola Sites on Tuesday. Now have full and comprehensive Google coverage for my site. Great stuff!!
John Shepherd

View More Testimonials

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Tell us what you think!

Live Chat is offline

Live Chat is available:
9am to 6:30pm Monday to Friday (excluding bank holidays).

01376 55 60 60

Send us a ticket.

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.