DocType Declaration

Web Browsers render the page by its doctype declaration. Each doctype has its own standards. For example, an element can be valid for HTML 4 but not valid in HTML5. You should always declare a doctype for each html that you are creating to correctly display the page.

Doctype are declared at the very top of your page. Doctype declaration starts with <!DOCTYPE > with the version written inside the tag.

Here are some doctype declarations:

 

HTML5:

<!DOCTYPE html>

HTML 4.01

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

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The latest version is HTML5. We suggest to use HTML5 to get the full functionality and features that are not included in other versions.

Share this tutorial!