Website Terminology Glossary
A doctype, short for Document Type Declaration, is an instruction that is included at the beginning of an HTML document to tell web browsers which version of HTML or XHTML the document is written in.
The doctype is important because it helps the browser understand how to render the content of the web page, and ensures that the page is displayed correctly for users. Without a doctype, the browser may not know which rules to apply when rendering the content, which can result in inconsistencies and errors.
Here are some examples of commonly used doctypes in HTML:
This is the simplest and most commonly used doctype, which is used for HTML5 documents. It instructs the browser to use the latest HTML5 standards when rendering the content.
HTML 4.01 Strict doctype
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
This doctype is used for HTML 4.01 documents that adhere strictly to the HTML 4.01 specification.
XHTML 1.0 Strict doctype
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
This doctype is used for XHTML 1.0 documents that adhere strictly to the XHTML 1.0 specification.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
This doctype is used for HTML 4.01 documents that contain transitional elements and attributes that are not part of the strict specification.
In summary, the doctype is an important part of an HTML document, as it tells web browsers which version of HTML or XHTML the document is written in, and helps ensure that the page is displayed correctly for users.