Skip to main content

Basic Structure

Every HTML document must follow a standardized structure so that browsers interpret it correctly.

Here is the minimum "skeleton" of an HTML5 web page:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is my first HTML document.</p>
</body>
</html>

Structure Analysis

  • <!DOCTYPE html>: Declares what type of document we are using (HTML5). It tells the browser to expect modern rules.
  • <html>: Is the root element. All the content of the web page must be contained within this element (and its opening <html> and closing </html> tags).
  • <head>: Contains metadata and information that is not directly displayed on the visible page. Here we include:
    • <meta charset="UTF-8">: Indicates that the file uses UTF-8 encoding, which allows displaying special characters and accents.
    • <title>: The text that appears in the browser tab and in search results.
  • <body>: Contains all the visible content of the page (texts, images, videos, links, buttons).

Ensuring that this structure is correct is fundamental before starting to add more content.