How to create your first HTML page

What HTML does

HTML gives web content structure. Elements identify a page's headings, paragraphs, links, images, and other parts; CSS controls presentation and JavaScript adds behavior.

Start with a document

Use this modern HTML5 foundation for every page.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My first page</title>
  </head>
  <body>
    <h1>Hello, web!</h1>
    <p>This is my first page.</p>
  </body>
</html>

Understand the parts

  • <!doctype html> selects modern HTML
  • lang tells assistive technology the page language
  • head contains metadata; body contains visible content
  • Most elements have an opening tag, content, and a closing tag

Save and check it

Save the file as index.html, open it in a browser, then edit, save, and refresh. Use lowercase filenames without spaces, indent nested markup consistently, and never put visible page content in head.