The main parts

  • <!DOCTYPE html> tells the browser to use modern HTML.
  • <html> wraps the entire document. Its lang attribute identifies the page language.
  • <head> contains information about the page, such as its character set and title. This information is not displayed as page content.
  • <body> contains the content visitors see, such as headings and paragraphs.

A basic page

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>A Page About Space</title>
  </head>
  <body>
    <h1>Our Solar System</h1>
    <p>Earth is one of eight planets.</p>
  </body>
</html>

The head and body are both inside html. Indenting them makes that nesting easier to see.

Learn more