HTML Questions & Answers Logo
HTML Questions & Answers Part of the Q&A Network
Q&A Logo

What’s the correct structure of an HTML 5 document?

Asked on Sep 29, 2025

Answer

The correct structure of an HTML5 document includes a series of essential elements that define the document's metadata, content, and structure. Here's a basic outline of an HTML5 document structure.
<!-- BEGIN COPY / PASTE -->
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document Title</title>
      </head>
      <body>
        <header>Header content</header>
        <main>Main content</main>
        <footer>Footer content</footer>
      </body>
    </html>
    <!-- END COPY / PASTE -->
Additional Comment:
  • The <!DOCTYPE html> declaration ensures the document is parsed in standards mode.
  • The <html> element is the root element of an HTML page.
  • The <head> section contains metadata and links to stylesheets or scripts.
  • The <body> contains all the visible content of the webpage.

✅ Answered with HTML best practices.


← Back to All Questions
The Q&A Network