HTML5 Basic Page Template (Boilerplate)

Every new web page starts with the same basic code. Save this HTML5 template and copy it whenever you start a new page.

HTML5 template

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="A short description of this page.">
  <title>Page Title</title>
  <link rel="icon" href="favicon.ico">
  <link rel="stylesheet" href="style.css">
</head>
<body>

  <header>
    <h1>Website Name</h1>
    <nav>
      <a href="/">Home</a>
      <a href="/about/">About</a>
    </nav>
  </header>

  <main>
    <h2>Page Heading</h2>
    <p>Page content goes here.</p>
  </main>

  <footer>
    <p>&copy; 2025 Website Name</p>
  </footer>

  <script src="app.js" defer></script>
</body>
</html>

What each part does

PartWhy it is there
<!DOCTYPE html>Standards mode in the browser
lang="en"Language of the page, for screen readers and search engines
charsetShows all characters correctly
viewportMakes the page work well on phones
descriptionText that search engines may show under the title
link and scriptConnect your CSS and JavaScript files
header, nav, main, footerSemantic layout of the page

Learn each part in HTML Page Structure.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.