HTML Foundations

Lesson 1 of 6

What Is HTML? Structure of a Web Page

HTML (HyperText Markup Language) is not a programming language, it's a markup language: it describes the structure and meaning of content on a page, not how to compute anything. Every website you've ever visited, however fancy, has HTML underneath it.

The skeleton of every page

HTML
PiecePurpose
<!DOCTYPE html>Tells the browser this is a modern HTML5 document.
<html lang="en">The root element; lang helps screen readers and search engines.
<head>Metadata: title, character encoding, linked stylesheets, not visible content.
<body>Everything the visitor actually sees.

Elements, tags, and attributes

An element is usually written as an opening tag, some content, and a closing tag: <p>content</p>. Some elements are void elements and never have a closing tag or content, like <img> or <br>.

An attribute adds extra information to a tag, written inside the opening tag as name="value":

HTML

Here src, alt, and width are all attributes of the img element.

NOTE

HTML elements can nest inside each other, but they must close in the reverse order they opened, <p><strong>bold</strong></p> is valid, <p><strong>bold</p></strong> is not.

📝 HTML Structure Quiz

Passing score: 70%
  1. 1.Which part of an HTML document holds the visible page content?

  2. 2.Void elements like <img> never have a closing tag.

  3. 3.In <img src="cat.jpg" alt="A cat" />, "src" and "alt" are called ____.