<!DOCTYPE> |
Document declaration |
Specifies HTML version to browser. |
<!DOCTYPE html> |
<html> |
Root |
Root of the HTML document. |
<html lang="en">…</html> |
<head> |
Metadata container |
Holds metadata: title, links, scripts, meta tags. |
<head><title>Title</title></head> |
<title> |
Metadata |
Document title shown in browser tab. |
<title>My Page</title> |
<meta> |
Metadata |
Charset, viewport, description, etc. |
<meta charset="utf-8"> |
<link> |
Resource |
External resource like stylesheet or icon. |
<link rel="stylesheet" href="styles.css"> |
<script> |
Scripting |
Embed or load JavaScript. |
<script src="app.js"></script> |
<body> |
Content root |
Main visible document content. |
<body>…</body> |
<header> |
Sectioning |
Introductory content or navigation for a section/page. |
<header><h1>Site</h1></header> |
<nav> |
Navigation |
Section with navigation links. |
<nav><a href='#'>Home</a></nav> |
<main> |
Sectioning |
Primary page content. |
<main>…</main> |
<section> |
Grouping |
Generic section of related content. |
<section><h2>Features</h2></section> |
<article> |
Independent content |
Self-contained composition (e.g., blog post). |
<article><p>…</p></article> |
<aside> |
Complementary |
Content tangential to main content (e.g., sidebar). |
<aside>Related links</aside> |
<footer> |
Sectioning |
Footer for section or page. |
<footer>© 2025</footer> |
<h1>–<h6> |
Headings |
Section headings with descending importance. |
<h2>Subheading</h2> |
<p> |
Text |
Paragraph. |
<p>Lorem ipsum.</p> |
<strong> |
Text semantics |
Strong importance (typically bold). |
<strong>Important</strong> |
<em> |
Text semantics |
Emphasis (typically italic). |
<em>Note</em> |
<span> |
Inline |
Generic inline container. |
<span class="highlight">Text</span> |
<div> |
Block |
Generic block container. |
<div>Wrapper</div> |
<br> |
Break |
Line break. |
Line1<br>Line2 |
<wbr> |
Preferred break |
Break here only if char sequence doesn't fit available space |
PartialExpression<wbr>RemainingExpression |
<hr> |
Thematic |
Thematic break (horizontal rule). |
<hr> |
<ul> |
List |
Unordered list. |
<ul><li>One</li></ul> |
<ol> |
List |
Ordered list. |
<ol><li>First</li></ol> |
<li> |
List item |
Item in ordered/unordered list. |
<li>Item</li> |
<dl> |
Definition list |
Container for terms and descriptions. |
<dl><dt>Term</dt><dd>Definition</dd></dl> |
<dt> |
Definition term |
Term in definition list. |
<dt>API</dt> |
<dd> |
Definition description |
Description for a term. |
<dd>Application Programming Interface</dd> |
<img> |
Media |
Image. |
<img src="pic.jpg" alt="desc"> |
<picture> |
Responsive image |
Container for multiple image sources. |
<picture><source media="(min-width:600px)" srcset="large.jpg"><img src="small.jpg"></picture> |
<video> |
Media |
Video playback. |
<video controls><source src="movie.mp4"></video> |
<audio> |
Media |
Audio playback. |
<audio controls><source src="sound.mp3"></audio> |
<iframe> |
Embedding |
Embed another HTML document. |
<iframe src="page.html"></iframe> |
<canvas> |
Graphics |
Drawable region via scripting. |
<canvas width="300" height="150"></canvas> |
<svg> |
Vector |
Scalable vector graphics container. |
<svg><circle cx="50" cy="50" r="40"></svg> |
<table> |
Tabular |
Table container. |
<table>…</table> |
<thead> |
Structure |
Header group of table. |
<thead><tr>…</tr></thead> |
<tbody> |
Structure |
Body group of table. |
<tbody>…</tbody> |
<tr> |
Row |
Table row. |
<tr>…</tr> |
<th> |
Header cell |
Header cell, usually bold/centered. |
<th>Name</th> |
<td> |
Data cell |
Regular table cell. |
<td>Value</td> |
<colgroup> |
Layout |
Group of columns for styling/width. |
<colgroup><col style="width:50%"></colgroup> |
<caption> |
Label |
Table caption/title. |
<caption>Summary</caption> |
<form> |
Input |
Form container for user input. |
<form action="/submit">…</form> |
<input> |
Control |
Single-line field (text, checkbox, radio, etc.). |
<input type="text" name="q"> |
<textarea> |
Control |
Multi-line text input. |
<textarea>…</textarea> |
<button> |
Control |
Clickable button. |
<button>Submit</button> |
<label> |
Form |
Label for form control. |
<label for="id">Name</label> |
<select> |
Control |
Dropdown list. |
<select><option>A</option></select> |
<option> |
Choice |
Option inside select. |
<option value="1">One</option> |
<fieldset> |
Grouping |
Group related form controls. |
<fieldset>…</fieldset> |
<legend> |
Caption |
Title for fieldset. |
<legend>Details</legend> |
<details> |
Disclosure |
Toggleable additional content. |
<details><summary>More</summary>Content</details> |
<summary> |
Disclosure |
Title for <details>. |
<summary>Title</summary> |
<template> |
Inert |
Markup not rendered until cloned. |
<template id="tpl"><div>Hi</div></template> |
<slot> |
Shadow DOM |
Projection point for light DOM. |
<slot name="foo"></slot> |
<abbr> |
Text |
Abbreviation with optional expansion. |
<abbr title="HyperText Markup Language">HTML</abbr> |
<code> |
Inline code |
Program code fragment. |
<code>let x=1;</code> |
<pre> |
Preformatted |
Preserves whitespace and line breaks. |
<pre>line1\nline2</pre> |
<blockquote> |
Quotation |
Long quotation. |
<blockquote>Quote</blockquote> |
<mark> |
Highlight |
Highlighted text. |
<mark>Search hit</mark> |
<time> |
Datetime |
Represents a date/time. |
<time datetime="2025-07-31">July 31, 2025</time> |