logo Learn HTML
  • Home
  • Tutorials
  • Practice
  • Quiz
  • Projects
  • About
  • Contact

HTML Course

  • HTML HOME
  • HTML Introduction
  • HTML Basic
  • HTML Element
  • HTML Attributes
  • HTML Headings
  • HTML Paragrapha
  • HTML Style
  • HTML Formattin
  • HTML Quotations
  • HTML Colors
  • HTML Css
  • HTML Links
  • HTML Image
  • HTML Favicon
  • Page Tittle
  • HTML Tables
  • HTML Lists
  • Block & Inline
  • HTML Div
  • HTML Classes
  • HTML Id
  • HTML Buttons
  • HTML Iframes
  • HTML File Paths
  • HTML Head
  • HTML Layout
  • HTML Symbols
  • HTML Emojis
  • HTML URL Encode
  • HTML VS XHTML
  • HTML FROM
  • HTML Form
  • Form Attributes
  • Form Elements
  • HTML Input Types
  • HTML Input Attributes
  • Input Form Attributes
  • HTML Graphics
  • HTML Canvas
  • HTML SVG
  • HTML Media
  • HTML Media
  • HTML Video
  • HTML Audio
  • HTML Plug-ins
  • HTML Youtube
  • HTML APIS
  • HTML Web APIS
  • HTML Geolocation
  • HTML Drag & Drop
  • Web Storage
  • Web Workers
  • HTML SSE
  • HTML Examples
  • HTML Examples
  • HTML Editor
  • HTML Quiz
  • HTML Exercises
  • HTML References
  • HTML Tag List
  • HTML Attributes
  • HTML Global Attributes
  • HTML Brower Support
  • HTML Events
  • HTML Colors
  • HTML Canvas
  • HTML Audio & Video
  • HTML Doctypes
  • HTML Character Sets
  • HTML URL Encode
  • Language Codes
  • HTTP Messages
  • HTTP Methods
  • PX to EM Converter
  • keyboard Shortcuts

HTML <!DOCTYPE> Declaration

The <!DOCTYPE> declaration is the very first line of every web page. It is an "instruction" to the browser, telling it what version of HTML to expect so it can display the page correctly.

Key Facts
  • It is NOT a tag: It is a declaration of the document type.
  • Case Insensitive: You can write it as <!DOCTYPE html> or <doctype html>.
  • Placement: It must be the absolute first line in your file, before the <html> tag.

Why use <!DOCTYPE>?

Browsers have two ways of reading a page:

  1. Standard Mode: The browser follows modern rules (triggered by a correct <!DOCTYPE>).
  2. Quirks Mode: The browser acts like an old 1990s browser (triggered if <!DOCTYPE> is missing), which often breaks modern layouts.

The Evolution of HTML Versions

In the past, declarations were long and difficult to remember. LearnHTML recommends always using the modern HTML5 version.


Version The Declaration
HTML5 <!DOCTYPE>
HTML 4.01 <!DOCTYPE HTML PUBLIC "-//LearnHTML/DTD HTML 4.01//EN"...
XHTML 1.1 <!DOCTYPE html PUBLIC "-//LearnHTML/DTD XHTML 1.1//EN"...

Element Support Comparison

As HTML evolved at LearnHTML, many old tags were removed to make room for modern, powerful elements


Tag Function HTML5 HTML4
<article> Independent content Supported No
<video> Plays movies Supported No
<audio> Plays sound Supported No
<center> Centers text Obsolete Yes
<font> Changes text font Obsolete Yes
<footer> Page bottom section Supported No

LearnHTML Summary Checklist

  • Always start your code with <!DOCTYPE htmlt;
  • Avoid old tags like <center> or <fpnt>; use CSS instead.
  • Use HTML5 semantic tags (like <header> and <footer>) to help search engines understand your site.

Try It Your Self

Sign Up For New
Update

HTML Basic
  1. HTML Basic
  2. HTML Element
  3. HTML Attributes
  4. HTML Headings
  5. HTML Paragrapha
  6. HTML Tables
  7. HTML Lists
HTML Advance
  1. HTML Div
  2. HTML Classes
  3. HTML Id
  4. HTML Buttons
  5. HTML Iframes
  6. HTML Symbols
  7. HTML Emojis