HTML basics

HTML is the language used to describe the content and structure of a web page. This guide introduces tags, elements, attributes, and the document structure beginners need first.

What you will learn

What HTML does

HTML gives content meaning and structure: a heading is a heading, a paragraph is a paragraph, and a link is a link. CSS controls presentation, while JavaScript adds behavior.

Tags and elements

<p class="intro">Welcome to the web.</p>

The opening and closing tags surround the content, and together with that content they form an element. The class="intro" part is an attribute that adds information to the opening tag.

Document structure

<!doctype html>
<html lang="en">
  <head>
    <title>A page</title>
  </head>
  <body>
    <h1>Page heading</h1>
    <p>A paragraph.</p>
  </body>
</html>

Elements can contain other elements, creating parent and child relationships. Keep the structure meaningful: headings should describe sections, and paragraphs should contain complete thoughts.

Special cases

Next steps