HTML Fundamentals Course: Building the Web
Sobre a Aula

Basic structure of an HTML document

Hello, students! In this lesson, we will learn the basic structure of an HTML5 document.

A web page is composed of an HTML document, which is a text file containing instructions for the browser to display the page.

The basic structure of an HTML5 document is as follows:

<!DOCTYPE html>
<html lang="pt-br">
<head>
  <title>Page Title</title>
</head>
<body>
  ...
</body>
</html>

Document Structure

The HTML5 document consists of three main parts:

  • Doctype: Indicates the version of HTML being used.
  • Head: Contains information about the page, such as the title, metadata, and references to external files.
  • Body: Contains the main content of the page, such as text, images, videos, etc.

Doctype

The doctype is the first line of the HTML document and indicates the version of HTML being used.

The doctype for HTML5 is as follows:

<!DOCTYPE html>

Head

The head is the section of the HTML document that contains information about the page.

Common information included in the head:

  • Page Title: Displayed in the browser’s title bar.
  • Metadata: Information about the page, such as description, keywords, and language.
  • References to External Files: References to external files, such as CSS style sheets or JavaScript scripts.

Body

The body is the section of the HTML document that contains the main content of the page.

The body content can be anything, including text, images, videos, etc.

Code Example

<!DOCTYPE html>
<html lang="pt-br">
<head>
  <title>My First HTML Document</title>
</head>
<body>
  <h1>My First Heading</h1>
  <p>This is my first paragraph.</p>
</body>
</html>

This code creates a simple HTML5 document with a title and a paragraph.

Exercises

  • Create an HTML5 document with a title, a paragraph, and an image.
  • Save the document and open it in a browser.

Observe how the browser displays the title, paragraph, and image.

Good luck!

Entrar na conversa
Rolar para cima