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
| Piece | Purpose |
|---|---|
<!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":
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.