📚 What is Doctype HTML?

📌 Key Concept

The <!DOCTYPE html> declaration should be the first line in an HTML document. It ensures browsers use the standard HTML5 parsing mode.

Why it's important

  • Triggers standards-compliant rendering in browsers.
  • Helps avoid quirks mode and inconsistent layout behavior.
  • Always place it at the very top of the HTML file.

Example

<!DOCTYPE html>
                        <html lang="en">
                        <head>
                            <meta charset="utf-8">
                            <title>Page title</title>
                        </head>
                        <body>
                            Hello world
                        </body>
                        </html>