What is <!DOCTYPE html> used for?

<!DOCTYPE html> is a a declaration that we use to inform the browser of any visitor that this document is an HTML document.

To be compliant with HTML standards, every HTML document should have DOCTYPE declaration.

The <!DOCTYPE html> should always be placed at the top of your HTML document:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=" />
    <title></title>
  </head>
  <body></body>
</html>

It's as simple as that!


Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊

Kofi

Share & Discuss on