HTML elements reference
Each entry has a live example, when to use it and what to watch out for. Open one in the playground to try it.
Open in the playground All CSS properties F12 DevTools guide
Basics
HTML document structureThe skeleton every web page starts from: doctype, html, head and body.Page layout with header, main and footerHow header, nav, main, section, article, aside and footer divide a page into meaningful parts.TablesBuilds a data table with caption, head, body, foot, merged cells and striped rows.ListsBulleted (ul), numbered (ol) and term-description (dl) lists, including nesting.FormsA complete form with labels, text and email inputs, select, radio buttons in a fieldset, textarea and a button.Images and videoShows an image with img, picture and figure, and a video player with video.Links and buttonsWhen to use a link (a) and when to use a button, and how to make each look the part.
HTML elements
Document and metadata
<html>The root element that wraps the whole HTML document.<head>Holds information about the page that is not drawn in the page itself.<title>Sets the page name shown in the browser tab, bookmarks and search results.<base>Sets the base address and default target for every relative link on the page.<link>Connects the page to another resource, such as a style sheet or a site icon.<meta>Stores data about the page, such as the character set, viewport and description.<style>Holds CSS written directly inside the HTML document.<body>Holds all the content people see on the page.
Page sections
<article>A self-contained piece of content that makes sense on its own.<section>A themed part of a document, usually starting with its own heading.<nav>A block of major navigation links.<aside>Content related to the main content that can stand apart from it.<h1–h6>Six levels of headings, from h1 (most important) to h6 (least).<hgroup>Groups a heading with its subtitle or tagline.<header>Introductory content for the page or a section, such as a logo, title or menu.<footer>Closing content for the page or a section, such as author, copyright or related links.<address>Contact information for the person or group behind a page or article.<main>The main content of the page, the part that is unique to it.<search>Wraps a search or filter form and the controls that go with it.
Grouping text
<p>A paragraph of text.<hr>A thematic break between paragraphs, drawn as a horizontal line.<pre>Preformatted text that keeps spaces and line breaks exactly as written.<blockquote>A long quotation taken from another source.<ol>An ordered list, where the order of the items matters.<ul>An unordered list, where the order of the items does not matter.<menu>A list of commands or tools, treated like an unordered list.<li>One item inside a list (ol, ul or menu).<dl>A description list of terms and their descriptions.<dt>The term or name in a description list.<dd>The description or value for a term in a description list.<figure>Self-contained content such as an image, chart or code sample, with an optional caption.<figcaption>The caption or legend for a figure.<div>A generic box with no meaning, used for grouping and styling.
Text meaning
<a>Creates a link to another page, a spot on the same page, or a file.<em>Marks words spoken with stress, where the stress changes what the sentence means.<strong>Marks text that is important, serious or urgent.<small>Holds side comments and fine print, such as legal notes or a copyright line.<s>Shows text that is no longer correct or relevant, with a line through it.<cite>Marks the title of a creative work, such as a book, film, song or paper.<q>Marks a short quotation that runs inside a sentence.<dfn>Marks the term that is being defined in this sentence or section.<abbr>Marks an abbreviation or acronym, with its full form in title if you like.<ruby>Puts small reading guides above characters, mostly for East Asian text.<rt>Holds the small note text inside a ruby element.<rp>Holds fallback parentheses around ruby notes for places that cannot show ruby.<data>Wraps visible text and ties it to a machine-readable value.<time>Marks a date, time or duration, with an exact form in datetime for machines.<code>Marks a piece of computer code, such as a tag, a property or a file name.<var>Marks a variable in math or code, or a placeholder the reader fills in.<samp>Marks sample output printed by a program or a computer system.<kbd>Marks keys to press or text the user should type in.<sub>Shows text lowered and smaller, as subscript, for things like chemical formulas.<sup>Shows text raised and smaller, as superscript, for powers and footnote marks.<i>Marks text in a different voice or mood, such as a term, a foreign phrase or a thought.<b>Draws attention to words without saying they are more important.<u>Underlines text to attach an unspoken note, such as a spelling error mark.<mark>Highlights text because it is relevant right now, such as a search match.<bdi>Isolates text whose writing direction is unknown, so it does not upset nearby text.<bdo>Forces the writing direction of its text, overriding the browser's own rules.<span>A plain inline wrapper with no meaning, used to style or target part of a line.<br>Breaks the line inside text, where the break is part of the content.<wbr>Marks a spot where the browser may break a long word or URL if it does not fit.
Edits
<ins>Marks text that was added to a document as an edit.<del>Marks text that was removed from a document as an edit.
Images, media and embeds
<picture>Wraps several image sources so the browser can pick the best one for the screen.<source>Lists one candidate file inside picture, video or audio.<img>Puts a picture on the page.<iframe>Shows another web page in a framed box inside the current page.<embed>Drops an outside resource, such as an SVG or PDF, into the page through a plugin-style slot.<object>Shows an outside file such as SVG or PDF, with fallback content if it cannot load.<video>Plays a video file with the browser's own player.<audio>Plays a sound file with the browser's own player.<track>Attaches a timed text file, such as subtitles, to a video or audio element.<map>Defines clickable regions on an image, together with area elements.<area>One clickable shape inside an image map.<svg>Draws vector graphics right in the HTML with shapes, paths and text.<math>Writes math formulas with MathML so the browser lays them out.
Tables
<table>Arranges data in rows and columns.<caption>Gives a table its title.<colgroup>Groups one or more columns of a table so you can treat them as a unit.<col>Stands for one or more table columns inside a colgroup.<tbody>Groups the main body rows of a table.<thead>Groups the header rows at the top of a table.<tfoot>Groups summary rows, such as totals, at the bottom of a table.<tr>Makes one row of cells in a table.<td>Holds one data cell in a table row.<th>Makes a header cell that labels a row or a column.
Forms
<form>Wraps input fields and sends what the visitor entered to an address.<label>Names a form field and ties the name to it.<input>A single form control whose look and behavior depend on its type.<button>A clickable button that can submit a form, reset it or run your own action.<select>A drop-down list (or list box) for picking from fixed options.<datalist>Offers a list of suggestions for an input, while still allowing free text.<optgroup>Groups related options inside a select under a heading.<option>One choice inside a select, datalist or optgroup.<textarea>A multi-line text box for longer answers.<output>Shows the result of a calculation or action inside a form.<progress>Shows how far a task has gone, such as an upload or a step-by-step form.<meter>Shows a measured value within a known range, like a gauge.<fieldset>Groups related form fields in a box with a shared caption.<legend>Gives a fieldset its title.
Interactive
<details>A box that opens and closes to show or hide extra content, with no script.<summary>The always-visible, clickable heading line of a details box.<dialog>A dialog box or pop-up window that can block the rest of the page.
Scripts and templates
<script>Loads or holds JavaScript, or a block of data, for the page.<noscript>Content shown only when scripts are turned off or not supported.<template>Holds a piece of HTML that is not shown, ready to be copied by script.<slot>A placeholder inside a shadow root where the host element's own children appear.<canvas>A blank pixel surface that script draws on.
Do not use
<acronym>Marked an acronym in HTML 4. Obsolete; use abbr instead.<applet>Embedded a Java applet in the page. Removed; browsers no longer run Java.<basefont>Set the default font size, color and face for a page. Obsolete; use CSS.<bgsound>Played a sound in the background in old Internet Explorer. Obsolete.<big>Made text one size bigger than the text around it. Obsolete in HTML5.<blink>Made text flash on and off. Never part of any HTML standard.<center>Centered its content across the page. Obsolete; use CSS instead.<dir>Made a list of file or folder names. Obsolete; use ul.<font>Changed the color, size and typeface of some text. Obsolete; use CSS.<frame>Loaded one HTML page into a pane of a frameset. Obsolete.<frameset>Split the browser window into rows or columns of frames. Obsolete.<noframes>Held content for browsers that could not show frames. Obsolete.<isindex>Added a one-line search box that sent words in the page address. Obsolete.<keygen>Made a key pair in the browser when a form was sent. Removed from HTML.<listing>Showed preformatted text in a fixed-width font. Obsolete; use pre.<marquee>Scrolled or bounced text across its box. Obsolete; use CSS animation.<menuitem>Defined one command in a pop-up or context menu. Removed from HTML.<nobr>Kept text on one line with no wrapping. Never standard; use CSS.<noembed>Held fallback content for browsers that could not run an embed. Obsolete.<param>Passed one name and value setting to an object plug-in. Obsolete.<plaintext>Turned the rest of the page into plain text, tags and all. Obsolete.<rb>Marked the base text inside a ruby note. Obsolete; write the text directly.<rtc>Grouped ruby notes into one extra line of annotation. Obsolete.<spacer>Added empty space in Netscape pages. Never standard; use CSS spacing.<strike>Drew a line through text. Obsolete; use s, del or CSS.<tt>Showed text in a fixed-width typewriter font. Obsolete in HTML5.<xmp>Showed its content as raw text, tags included. Obsolete; use pre.<image>A misspelled img that the HTML parser silently turns into img. Never valid.