About 1210 letters

About 6 minutes

#Structure of an HTML Document

Here is a basic example:

<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
        <meta charset="utf-8"/>
    </head>

    <body>
        <h1>This is a Heading</h1>
        <p>This is a paragraph</p>
    </body>
</html>
  • <!DOCTYPE html> declares that this is an HTML5 document
  • <html> ... </html> is the root element that contains the entire content of the document
  • <head> ... </head> is the document head, used for setting the page title, styles, scripts, etc.
  • <body> ... </body> is the document body, which is the visible part of the page

Create a new text file, copy the above code into it and save it. Then rename the file extension to .html and open the file in a browser.

It will look like this:

Page Title

Updated: 5/16/2025

Author: PlanC

Created: 5/16/2025