HTML 5 Notes For Professional – Chapter – 2 (Doctypes)

Doctypes – short for ‘document type’ – help browsers to understand the version of HTML the document is written in for better interpretability. Doctype declarations are not HTML tags and belong at the very top of a document. This topic explains the structure and declaration of various doctypes in HTML.

Adding the Doctype

The <!DOCTYPE> declaration should always be included at the top of the HTML document, before the tag.

Version ≥ 5

Advertisement

See HTML 5 Doctype for details on the HTML 5 Doctype.

<!DOCTYPE html>

HTML 5 Doctype

HTML5 is not based on SGML (Standard Generalized Markup Language), and therefore does not require a reference to a DTD (Document Type Definition).

HTML 5 Doctype declaration:

Advertisement
<!DOCTYPE html>

Case Insensitivity

Per the W3.org HTML 5 DOCTYPE Spec:

A DOCTYPE must consist of the following components, in this order:
1. A string that is an ASCII case-insensitive match for the string “<!DOCTYPE>”.

therefore the following DOCTYPEs are also valid:

Advertisement
<!doctype html>
<!dOCtyPe html>
<!DocTYpe html>

This SO article discusses the topic extensively: Uppercase or lowercase doctype?

Continue to Chapter 3: Headings

Advertisement

Recent Posts

Securing phpMyAdmin Like a Pro: Essential Tips and Tricks

Securing phpMyAdmin is crucial to prevent unauthorized access and protect your databases. Here's a guide…

5 months ago

Pasqal raises $100M to build a neutral atom-based quantum computer

Pasqal, a Paris-based quantum computing startup, today announced that it has raised a $100 million…

1 year ago

Apple in talks with Disney, others on VR content for new headset: Report

Developed with Sony Group Corp, the headset will have two ultra-high-resolution displays to handle the…

1 year ago

Microsoft, Amazon results to highlight softening cloud business

After years of blistering growth, most recently fuelled by remote working and studying during the…

1 year ago

Intel chairman Omar Ishrak steps down

Omar Ishrak had stepped down and the chipmaker appointed board director Frank Yeary as his…

1 year ago

Canada to commercialise world's first photonic-based quantum computer

Canadian Prime Minister Justin Trudeau has announced a new federal investment to build and commercialise…

1 year ago