Reference HTML Elements

This is a catalog of HTML elements. There's also an API and Templates available.

There's plenty of HTML reference documentation in the world, so why build another?

Other reference documentation is either too verbose, meaning there's so much detail it makes it hard to find the key parts that you need, or it's too minimal, meaning there are important parts left off in favor of making it highly condensed. This catalog aims to provide a goldilocks solution by balancing comprehensive documentation with ease of use.

The goals of this catalog are to be clear, easy to use, and fast:

Search

Table of Contents

HTML is divided into different types of elements, each of which serves a purpose in structuring content for the user. Some elements organize, some denote meaning, some add tabular structures, while others submit data or interact with the page.

Metadata
Sectioning
Block content
Inline content
Multimedia
Embedded
Scripting
Edits
Tables
Forms
Interactive
Web Components

Using the Catalog

Structure

Each element in the catalog has name, description, display, code, and attributes. These appear in a compact layout as follows:

<Name of Element>

Description of the element giving its purpose and usage

Sample display
  • List of attributes

Here's an example of the abbr or abbreviation tag:

Used to capture an abbreviation, by default this displays a tooltip of the 'title' attribute on hover

abbr
  • title, determines tooltip text that user sees upon hovering over the abbreviation tag

Types of Tags

Other HTML references focus on categorizing elements as having normal or self closing tags. This one does not. Since example code is provided with each element, it should be clear which elements have opening and closing tags and which have self closing tags. In cases where this really matters, the description will specify which type of tag the element uses.

Global Attributes

There are common HTML attributes that apply to every element. This list is omitted from the reference, because it would be incredibly duplicative to reproduce them under each element. The common global HTML attributes:

This concludes the section on using the catalog. On to the elements!


Catalog

Metadata

Metadata is data that describes other data or provides information in the form of a label. For an HTML document, that means data about the title of the document, its relationship to other resources, how various user agents should treat it, and more.

Set the page's title, which displays in the browser's menu bar

See title in browser window

Defines CSS styles to be applied to the document

Tag does not display but the effect of CSS shown here

  • media: defines media to apply style to, accepts a media query value, defaulting to all if attribute missing
  • nonce: cryptographic nonce (number used once) used to whitelist inline styles, see style-src CSP
  • title: specifies an alternative style sheet set

Specifies the base URL for all relative URLs in an HTML document

Does not display

  • href: hypertext reference or address
  • target: keyword (_self, _blank, _parent, _top) or name of default browsing context to display the result of links

Sets metadata not covered by other tags

Does not display

  • charset: declares the page's character encoding (please just use UTF-8)
  • content: contains the value for the http-equiv or name attribute
  • http-equiv: defines directives, allowing values named after HTTP headers
    • content-security-policy: define a content policy for the current page, protecting against cross-site scripting
    • refresh: number of seconds until page should be reloaded/redirected, requires inclusion of '; url='
  • name: defines name of document-level metadata
    • application-name: name of web application running in page (only used for applications)
    • author
    • description: short and accurate summary of the page's content
    • generator: identifier of software that generated page
    • keywords: words relevant to the page's content separated by commas
    • referrer: address of previous webpage
    • theme-color: suggested color used to customize display of page; content attribute accepts valid CSS color
    • color-scheme: specifies light or dark color modes (accepts normal, light | dark, only light)
    • publisher
    • robots: defines behavior that web crawlers should follow
    • viewport: used by mobile devices to hint at the initial size of the viewport

Sectioning

Sectioning elements are used to organize a document into logical pieces. Think of this as your document's outline. Elements give logical structure not visual structure. I've depicted it visually below, so you can get a general sense for how most pages employ these elements. However, there's no relationship between HTML logical structure and how it's visually presented:

body

header

nav

main

h1

h2

h3

h4

h5
h6

aside

For the sectioning elements, the display portion of the reference may simply say 'Displays content' which means that the tag does not inherently have a specific display, but instead that it simply displays what it wraps around or contains. For the sake of conciseness, the reference does not always show that content.

Container for all visible content and a required part of any HTML document

Displays content

Attributes on the body tag all assign a function to be called when a certain event happens:

  • onafterprint
  • onbeforeprint
  • onbeforeunload
  • onblur
  • onerror
  • onfocus
  • onhashchange
  • onlanguagechange
  • onload
  • onmessage
  • onoffline
  • ononline
  • onpopstate
  • onredo
  • onresize
  • onstorage
  • onundo
  • onunload

Container for holding the content of the main or primary purpose of the document

Displays content

Section of content that is indirectly related to the main section (e.g. sidebars, call-out boxes)

Displays content

Self-contained portion of a document which is designed to be independently distributable or reusable (e.g. forum post, magazine article, blog entry)

Displays content

Stand alone section that is not represented by another more specific content section element. This is the sectioning version of a div or span (generic, without specific semantic meaning), but should not be used in place of a div. A section should still appear in a document outline.

Displays content

Descending levels of section headings which are used to give titles and introduce content. <h1> represents the highest level section. It's possible to have multiple sets of headings on a page, as long as they apply to different sections.

Favorite Books

Fantasy

High/Epic

  • The Lord of the Rings
  • The Wheel of Time

Magical Realism

Science Fiction


Block content

Organize your text, establish the structure of your content, and its purpose using text content elements.

<p>

Paragraph element is a block element that groups together related content

Paragraph here

Horizontal rule is a suggested break in content, indicating when subject matter has changed


Generic element to divide up content and style it; has no semantic meaning at all

Divided, we fall

Ordered list that typically displays as sequential numbers

  1. Wake up
  2. Brush teeth
  3. Learn code
  • reversed: specify whether list should be in reverse order
  • start: integer to start counting the list from (must be numeral: 1, 2, 3)
  • type: sets numbering type (letters [a, A], roman numerals [i, I], numbers [1, default])

List items must be nested in a list element and represent individual entries

  1. HTML
  2. CSS
  3. JS
  • value: current value of ordered list item

Unordered list that typically displays as bulletpoints

  • Peas
  • Tomatoes
  • Carrots

Image, graph, diagram, chart, codeblock or other visual element referenced as a single element

Red house on side of green hill

An editorial or illustrative caption1 for a figure or a collection of media contained as one figure

Red house on side of green hill
HTML's Red Haus

Extended quotation that should be indented and separately credited as part of another work

To be, or not to be, that is the question! -Hamlet
  • cite: URL that designates the source of the quote

Preformatted text that should be treated and rendered exactly as it is input

Bring me a figgy pudding

A description/definition list element captures a list of terms (<dt>) and their definitions (<dd>)

Web Technologies

Hyper Text Markup Language
Used to create elements and define documents
Cascading Style Sheets
Applies visual styles to HTML elements
JavaScript
ECMAScript
Enables interactivity inside of documents

Description/definition term specifies a single term in a list, which will be defined by a <dd>

Hyper Text Markup Language
Used to create elements and define documents

Description/definition for the preceding term defined with a <dt>

Cascading Style Sheets
Applies visual styles to HTML elements

Inline content

<a>

Anchor element creates a hyperlink to web pages, files, emails, locations on the same page, or any other valid URL

  • download: prompts to save the linked URL instead of navigating to it
  • href: URL that the hyperlink points to, which can be sections of a page, pieces of media files, 'tel:' numbers, 'mailto:' addresses
  • hreflang: the human language of the linked URL; allowed values are the same as the global lang
  • ping: space-separated list of URLs, which the browser will send POST requests with the body PING to, when the link is followed
  • referrerpolicy: how much of the referrer to send when following the link
    • no-referrer: does not send the referer header
    • no-referr-when-downgrade: referer header will not be sent to origins without TLS (HTTPS)
    • origin: sent referer is limited to origin of refering page (scheme, host, port)
    • origin-when-cross-origin: limited to scheme, host, and port, except path will be included for navigation on same origin
    • same-origin: referrer sent for same origin, but cross-origin requests will contain no referrer information
    • strict-origin: only send origin when security protocol remains the same (HTTPS to HTTPS)
    • strict-origin-when-cross-origin: send full URL when performing a same-origin request, only send origin when protocol remains the same, and send no referer header to less secure destinations
    • unsafe-url: referrer will incldue the origin and path, but not the fragment, password, or username
  • rel: relationship of the linked URL as space-separated link types
  • target: where to display the linked URL (tab, window, or iframe) with keywords: _self, _blank, _parent, _top
  • type: linked URL's format with a MIME type

Abbreviation element represents an acronym

MIME
  • title: must contain a full human readable description or expansion of the abbreviation

<b>

Bring Attention To element draws the reader's attention to the element's contents

Houses are built with certain kinds of material like wood and stone.

Creates a line break (enter/carriage-return) in your text

Amid pleasures and palaces
though we may roam,
Be it ever so humble,
there's no place like HOME

Citation provides a reference to a creative work and generally includes the title of that work

Poe's gothic masterwork starts with a dreary description, DURING the whole of a dull, dark, and soundless day in the autumn of the year, when the clouds hung oppressively low in the heavens, setting the tone for the The Fall of the House of Usher.

Short fragment of computer code

Use the JavaScript querySelector(selectors); function to retrieve an element

  
:root {
  --hausorange: #db3700;
}
  

Links enclosed content with a machine-readable translation (such as serial numbers)

  • Flux Capacitor
  • Mr. Fusion Energy Reactor
  • DMC DeLorean
  • value: specifies the machine-readable translation

Definition element is used to indicate the term being defined within the context of a p, dt, or dd

A flibbertigibbet is a frivolous, flighty, or excessively talkative person.

Emphasis element marks text that should be stressed, allows nesting in degrees

The house is on fire!

<i>

Represents a range of text set off from normal text, such as technical terms, foreign language, fictional character thoughts, usually displaying in italics

This house is not my home, he thought with sudden panic.

Keyboard input marks user input from a keyboard, voice input, or any other text entry device

Press Ctrl + Shift + C to inspect HTML on this page.

Marked or highlighted text for reference or notation purposes, usually for relevance or importance

The most important part of a house is the foundation.

<q>

Quotation is for short quotes that do not require a new paragraph (use blockquote instead)

Dr. House provides sage advice, If you’re not willing to look stupid, nothing great is ever going to happen to you.

  • cite: URL that designates source for the information quoted

<s>

Represents things that are no longer relevant or accurate, rendering with a strikethrough

Things to learn:

  • HTML
  • CSS
  • JavaScript

Sample element encloses output from a computer program

When this finishes loading, reload the page:
100% Complete

Represents small print such as copyrights or legal disclaimers, rendering content one size smaller

HTML.Haus is a website for learning and using HTML.

Licensed under Apache-2.0

Generic element that represents no semantic meaning but can be used as a last resort for styling

Our website's chosen color is Haus Orange.

Strong importance indicates seriousness or urgency and usually renders as bold by default

Haus Rules:

  1. Use semantic tags over generics when possible
  2. Never have an image without alternate text
  3. Always write HTML with universal design in mind

Specifies subscript text such as with footnotes or math variables or in chemistry

Solve this equation:
x1 + x2 + 4x3 = -9

Specifies superscript used for ordinal numbers in dates or exponents

Was Pythagoras the 1st great mathematician?

Pythagorean theorem:
a2 + b2 = c2

Represents a specific period in time either: time on a 24-hour clock, precise date, or time duration

Back to the Future Day is

  • datetime: time and/or date of the element in a valid format, see examples below:
    • year: 2015
    • month: 2015-10
    • date: 2015-10-21
    • time: 01:16
    • local date+time: 2015-10-21 01:16

<u>

Unarticulated annotation element indicates non-textual annotation, often for spelling errors

Our house in the middle of our stret.

Variable in a program or mathematical expression

Force equals mass mutliplied by acceleration:

F = M x A

Word break opportunity or a position where the browser may optionally break the line

Mary Poppins always liked singing supercalifragilisticexpialidocious!

Multimedia

Elements that create images, audio, or video resources

Embed an image into the document

Red house on side of green hill
  • src: source contains the reference to the image you are embedding
  • alt: provides alternate text for the image in case it cannot load or for screen readers
  • height: intrinsic height of the image in pixels (must be an integer)
  • width: intrinsic width of the image in pixels (must be an integer)
  • sizes: indicates a set of source sizes described as strings separated by commas, which contain a media condition and a soruce size value. Media conditions describe the viewport, e.g. (max-width: 600px) 95vw, (min-width: 600px) 90vw
  • srcset: indicates a set of image sources described as strings separated by commas, which contain the URL to an image and a width descriptor, e.g. img/foundation-600.jpg 600w, img/foundation-900.jpg 900w
  • crossorigin: indicates if CORS is required to retrieve/fetch the image (values: anonymous or use-credentials)
  • decoding: suggests to the browser how to decode (sync, async, auto)
  • ismap: boolean indicating that the image is part of a server-side map
  • usemap: the partial url (starting with #) of an image map (see below) associated with the element

Defines an image map, used in conjunction with the <area> tag (see next)

HTML's Haus Red house on hill
  • name, this attribute is used to reference the map and is required
  • id, if specified, then must be the same value as the name attribute

Defines a region of an image inside an image map (see previous); it's important to remember that this element is essentially a fancy anchor element, so has access to similar attributes

Red house for HTML Green slope to MDN Documents Red house on hill
  • alt: provides alternate text for the image in case it cannot load or for screen readers
  • coords: set of values specifying the coordinates of the hot spot or region of the map
    • circle: x,y,r, with the center expressed as x,y and then the radius as r
    • poly: set of x,y pairs for every point in the polygon
    • rect: two pairs of coordinates describing the left, top, right, bottom
  • download: prompts to save the linked URL instead of navigating to it
  • href: URL that the hyperlink points to, which can be sections of a page, pieces of media files, 'tel:' numbers, 'mailto:' addresses
  • hreflang: the human language of the linked URL; allowed values are the same as the global lang
  • ping: space-separated list of URLs, which the browser will send POST requests with the body PING to, when the link is followed
  • referrerpolicy: how much of the referrer to send when following the link
    • no-referrer: does not send the referer header
    • no-referr-when-downgrade: referer header will not be sent to origins without TLS (HTTPS)
    • origin: sent referer is limited to origin of refering page (scheme, host, port)
    • origin-when-cross-origin: limited to scheme, host, and port, except path will be included for navigation on same origin
    • same-origin: referrer sent for same origin, but cross-origin requests will contain no referrer information
    • strict-origin: only send origin when security protocol remains the same (HTTPS to HTTPS)
    • strict-origin-when-cross-origin: send full URL when performing a same-origin request, only send origin when protocol remains the same, and send no referer header to less secure destinations
    • unsafe-url: referrer will incldue the origin and path, but not the fragment, password, or username
  • rel: relationship of the linked URL as space-separated link types
  • shape: default uses the entire image, while circle, poly, and rect describe subsets with coordinates
  • target: where to display the linked URL (tab, window, or iframe) with keywords: _self, _blank, _parent, _top

Embed sound content in your document, allowing for more than one audio source

  • autoplay: boolean specifying automatic playback
  • controls: if present, user will be provided controls for volume, seek, and pause/resume
  • crossorigin: indicates whether to use CORS or not (anonymous or use-credentials)
  • currentTime: reading returns current playback position, setting adjusts to given time
  • duration: total length of the audio in secondss
  • loop: boolean determing if audio should start over after it reaches maximum duration
  • muted: boolean indicating whether the audio will be initially silenced
  • preload: hints to browser what best user experience will be (none, metadata, auto)
  • src: URL of audio to embed; you may also use the source element instead

Embed a media player that will play video into the document

  • autoplay: boolean specifying whether video should automatically start playing
  • buffered: attribute that returns a TimeRanges object describing the already buffered media
  • controls: if present, the browser will present controls to allow pause, resume, seek and volume
  • crossorigin: whether to use CORS to fetch the related image or not (anonymous, use-credentials)
  • currentTime: reading returns current playback position, setting adjusts to given time
  • duration: total length of media returned in seconds
  • height: attribute setting height in CSS pixels, requires absolute values only (no percentages)
  • loop: boolean determining if browser will automatically restart at beginning once end is reached
  • muted: boolean determining if audio should be initially silenced
  • playsinline: boolean attribute determining that the video should be played inside of the element's area (not fullscreen)
  • poster: URL for image to be shown while the video is downloading
  • preload: hints to browser what best user experience will be (none, metadata, auto)
  • src: URL of video to embed, you may use the source element inside the video block instead
  • width: width of video's display area in CSS pixels, requires absolute values only (no percentages)

Child of either audio or video elements, specifying the timed text tracks

  • default: only usable on one track element, indicates that this track should be enabled unless otherwise specified
  • kind: how the track is to be used
    • subtitles: translations of content or additional information such as date, time, or location of a scene
    • captions: transcription of audio (possibly a translation as well), music cues, or sound effects
    • descriptions: textual description of the video content
    • chapters: chapter titles to be used for the purpose of navigation
    • metadata: tracks used by scripts which are not visible to the user
  • label: user readable title that is listed to the user
  • src: URL to the track (a .vtt file)
  • srclang: valid language of track text data, and if the kind is subtitles, then srclang must be defined

Embedded

Embed content from elsewhere (external) in your document

Content usually provided by an external application or browser plug-in (do not use)

Do not use

Embeds one HTML page inside of another, creating nested browsing context, which means a new session history and document

  • allow: specifies a feature policy for the iframe (e.g. allow="fullscreen")
    • fullscreen: allows iframe to call requestFullscreen() method
    • payment: allows iframe to call the payment request API
  • height: height of the frame in CSS pixels (default is 150)
  • name: name for embedded browsing context
  • referrerpolicy: which referer to send when fetching the frame's resources
    • no-referrer: does not send the referer header
    • no-referr-when-downgrade: referer header will not be sent to origins without TLS (HTTPS)
    • origin: sent referer is limited to origin of refering page (scheme, host, port)
    • origin-when-cross-origin: limited to scheme, host, and port, except path will be included for navigation on same origin
    • same-origin: referrer sent for same origin, but cross-origin requests will contain no referrer information
    • strict-origin: only send origin when security protocol remains the same (HTTPS to HTTPS)
    • strict-origin-when-cross-origin: send full URL when performing a same-origin request, only send origin when protocol remains the same, and send no referer header to less secure destinations
    • unsafe-url: referrer will incldue the origin and path, but not the fragment, password, or username
  • sandbox: applies extra restrictions to the content in the frame; empty applies all restrictions, while space separated list removes restrictions individually
    • allow-forms: allows the iframe to submit forms
    • allow-modals: allows the iframe to open modal windows
    • allow-orientation-lock: allows the iframe to lock screen orientation
    • allow-pointer-lock: allows the iframe to use the pointer lock API
    • allow-popups: allows popups
    • allow-popups-to-escape-sandbox: allows popups that do not inherit the sandbox rules
    • allow-presentation: allows a presentaion session to start
    • allow-same-origin: pass the same-origin policy
    • allow-scripts: allow the iframe to run scripts but not create popup windows
    • allow-top-navigation: allow the iframe to navigate the top level browsing context
    • allow-top-navigation-by-user-activation: allow the iframe to navigate top if a user gesture initiates
  • src: URL of document to embed
  • srcdoc: inline HTML to embed, overriding the src attrbutes
  • width: width of iframe in CSS pixels (default is 300)

A generic external resource that can be an image, iframe or resource for a plugin

  • data: address of resource as a valid URL, required
  • type: content type of resource specified by data, required
  • form: ID of a form element the object is associated with in the document
  • height: height of displayed resource in CSS pixels (absolute values required, no percentages)
  • name: name of valid browsing context
  • typemustmatch: boolean indicating that type and actual content type of the resource must match
  • usemap: hash-name reference to a map element (e.g. #haus)
  • width: width of displayed resource in CSS pixels (absolute values required, no percentages)

Defines a parameter inside of an object element

Does not display
  • name: name of the parameter
  • value: value of the parameter

Element with multiple source elements and one image element that allows the browser to select the best image for the device and situation (e.g. screen size, network bandwidth)

  • media: media condition to be evaluated for the source element
  • srcset: list of possible images based on size
  • type: specifies the MIME type for the resource URLs

Scripting

Elements to import JavaScript, the web's programming language primarily used to add interactivity to documents

Embed JavaScript into your document with this element

MM/DD/YY
  • async: script will be fetched in parallel to document parsing and evaluated as soon as is possible
  • crossorigin: force passing CORS checks, allowing error logging when a site uses a separate domain for static media
  • defer: boolean indicating script should be executed after the document has been parsed but before DOMContentLoaded
  • integrity: inline metadata used to verify that a fetched resource has been delivered without manipulation
  • nomodule: boolean indicating script should not be executed if browser supports ES2015 modules
  • nonce: cryptographic number used once (nonce) to whitelist in-line scripts in a script-src CSP
  • referrerpolicy: indicates which referrer to send when fetching the script
    • no-referrer: does not send the referer header
    • no-referr-when-downgrade: referer header will not be sent to origins without TLS (HTTPS)
    • origin: sent referer is limited to origin of refering page (scheme, host, port)
    • origin-when-cross-origin: limited to scheme, host, and port, except path will be included for navigation on same origin
    • same-origin: referrer sent for same origin, but cross-origin requests will contain no referrer information
    • strict-origin: only send origin when security protocol remains the same (HTTPS to HTTPS)
    • strict-origin-when-cross-origin: send full URL when performing a same-origin request, only send origin when protocol remains the same, and send no referer header to less secure destinations
    • unsafe-url: referrer will incldue the origin and path, but not the fragment, password, or username
  • src: specifies the URI of an external script, which is to be used as an alternative to embedding a script
  • type: type of script
    • text/javascript: this is the safest MIME type for all browsers and for forward compatibility
    • module: treat code as JavaScript module (requires use of CORS)

Defines what is displayed if JavaScript is unsupported or scripting is turned off in the browser

Element that can draw graphics and animations

Simple red rectangle with triangle on top, representing a house
  • height: height in CSS pixels of the drawing space (canvas)
  • width: width in CSS pixels of the drawing space (canvas)

Edits

Elements that mark parts of the document that have been edited

Represents a range of text that has been deleted

Tonight's Open House:
Tickets Available for $50

  • cite: URI for a resource that explains the change
  • datetime: time and date of the change, must be valid datetime format

Represents a range of text that has been inserted

Tonight's Open House:
Tickets Available for $50
SOLD OUT!

  • cite: URI for a resource that explains the change
  • datetime: time and date of the change, must be valid datetime format

Tables

Elements to create tables and handle tabular data (presented as rows and columns)

Creates a two-dimensional table comprised of rows (tr) and columns with cells (td)

Technology Purpose
HTML Define structure
CSS Style content

Provides the name or title of a table

Web Technology
Language Purpose
HTML Define structure
CSS Style content

Table row element defines a row inside your table

Name Profession
Hypertext Hank Build Webpages

Table data element defines a cell (and its data) within a table row

Material Purpose
Wood 2x4s Framing
  • colspan: accepts integer value that indicates how many columns the cell extends
  • headers: list of space-separated strings corresponding to the ids of th elements (see below)
  • rowspan: accepts integer value that indicates how many rows the cell extends

Table header is the first cell of either a row or column, as specified by scope or headers attributes

Lang Chars Purpose
HTML 4 Create structure
CSS 3 Style content
JS 2 Make interactive
  • abbr: abbreviated description of the cell's contents
  • colspan: accepts integer value that indicates how many columns the cell extends
  • headers: list of space-separated strings corresponding to the ids of th elements (see below)
  • rowspan: accepts integer value that indicates how many rows the cell extends
  • scope: defines the cells that the header defined in the th element relates to:
    • row: header relates to all cells of the row it belongs to
    • rowgroup: belongs to a rowgroup and relates to all of its cells
    • col: header relates to all cells of the column it belongs to
    • colgroup: belongs to a colgroup and relates to all of its cells
    • auto: default value

Defines a column within a table, usually used within a colgroup (see next) element

Language Characters
HTML 4
CSS 3

Defines a group of columns within a table and has col elements as children

Language Characters
HTML 4
CSS 3
  • span: integer indicating the number of consecutive columns the colgroup element spans

Defines a set of rows as the head columns inside a table

Material Purpose
Wood 2x4s Framing

Encloses a set of rows identified as the body of the table, containing data

Material Purpose
Wood 2x4s Framing

Defines a set of rows that summarizes or totals the columns of the table

Language Lines of Code
HTML 150
CSS 75
Total 225

Forms

Elements that allow a user to provide information and submit as part of a website or web application

Parent element to encase interactive controls for submitting information

  • accept-charset: space-separated character encodings that the server accepts; browser will use them in order
  • action: the URL (endpoint) that processes the form submission, can be overriden by a formaction attribute on a button or input type=submit or input type=image element
  • autocomplete: indicates whether the form or an input element inside the form can be autocompleted by the browser, either 'off' or 'on' values
  • enctype: if the value of the method (see next) attribute is post, thne enctype is the MIME type of the form submission
    • application/x-www-form-urlencoded: default value
    • multipart/form-data: used if the form contains an input type=file element
    • text/plain: used for debugging purposes
  • method: the HTTP method used to submit the form
    • post: the POST method means the form data is sent as the request body
    • get: the GET method appends form data to the action URL with a ? separator, useful when form has no side-effects
    • dialog: when the form is inside a dialog, closes the dialog on submission
  • novalidate: form should not be validated when submitted
  • target: where to display the response after submitting the form
    • _self (default): loads into same browsing context as current
    • _blank: load into a new unnamed browsing context
    • _parent: load into the parent browsing context of the current one
    • _top: load into the top-level browsing context

Group several form elements together within a form




  • disabled: boolean determining if form controls within fieldset are disabled or not
  • form: takes value of an id attribute of a form element that you want fieldset to be a part of, even outside of the form
  • name: associated with the group

Caption or title for the contents of a fieldset, usually the first child element

Favorite HTML tag


A caption for a portion of your user interface, explaining what it does and associating with it


  • for: id of a labelable form-related element in the same document
  • form: id of a form element in the same document (this allows you to label from outside a form)

Element for accepting user input or data, covering a wide range of different controls























The following attributes apply to all input types with a few exceptions marked by *:

  • autocomplete: hint to browser whether form should autofill
  • autofocus: automatically focus this form when page is loaded
  • disabled: boolean whether input is disabled or ont
  • form: associates input with a form
  • list*: value of the id attribute of the datalist of autocomplete options
  • name: name of the input which is submitted with the form as part of a name/value pair
  • readonly*: boolean determining that value is not editable
  • required*: boolean making this input required before form can be submitted
  • type: type of input element
  • value: current value of the input, which is submitted with the form as part of a name/value pair

There are additional attributes for individual input types that can be found on the full input page (TBD).

Control that provides a menu of options

  • autocomplete: provides a hint as to how autocomplete should work
  • autofocus: boolean determining if form receives focus when the page loads
  • disabled: boolean indicating whether select element can be used
  • form: the parent form or owner of the select element
  • multiple: boolean indicating whether multiple options can be selected (or not)
  • name: name of the element
  • required: boolean indicating whether element is required to be selected
  • size: if multiple is true, then this determines number of visible rows

Used to define individual options within a select, optgroup, or datalist element

  • disabled: boolean determining if option is checkable
  • label: text for the label indicating the meaning of the option (if undefined, then element's text content serves in its place)
  • selected: boolean determining if this option is initially selected
  • value: value to be submitted with the form, if the option is selected

Groups option elements within a select element

  • disabled: boolean determining if option group is available
  • label: name of the group of options

Contains a set of option elements that are available to choose from within other controls

Multi-line plain text input box which is suited to users entering large amounts of text

  • autocomplete: indicates whether the value of the textarea can be automatically completed
    • "on": the browser can automatically complete the textarea based on values previously used
    • "off": the user must explicitly enter a value into this field for every use (or the document provides its own auto-complete)
  • autofocus: boolean determining whether textarea should have focus when page loads
  • cols: visible width of textarea in average character widths; it must be a positive integer (default is 20)
  • disabled: boolean determining whether textarea is usable or not
  • form: the associated parent or owner of the textarea element
  • maxlength: maxiumum number of characters (UTF-16 code units) that can be entered into the textarea
  • minlength: minimum number of characters (UTF-16 code units) required to be entered into the textarea
  • name: name of the textarea
  • placeholder: hint to user what should be entered into the textarea
  • readonly: boolean indicating that user cannot modify value of textarea
  • required: boolean indicating that user must fill in a value before form can be submitted
  • rows: visible height of textarea
  • spellcheck: specifies whether textarea is subject to spell checking by the browser or operating system
    • "true": indicates that element input should have spelling and grammar checked
    • "false": indicates that element input should not be spell checked
    • "default": indicates that element input should follow parent element's own 'spellcheck' value
  • wrap: indicates how the textarea wraps text at the end of a line
    • "hard": browser automatically inserts line breaks so that each line has no more width than control, requires cols
    • "soft": browser ensures that all line breaks in the value consist of a CR+LF pair, but does not insert additional breaks

Scalar value within a known range or a fractional value

  • min: lower numeric bound of the measured range (the minimum)
  • max: higher numeric bound of the measured range (the maximum)
  • value: the current numeric value inside of the range
  • low: the upper numeric bound of the low end of the measured range
  • high: the lower numeric bound of the high end of the measured range
  • optimum: the optimal numeric value, used with the low or high attributes to indicate where along the range is preferable
  • form: the parent or owner form element of the progress element

Displays a progress bar, indicating how complete any given thing is

30%
  • max: describes how much work the task indicated by the progress element requires
  • value: describes how much of the task has been completed, indicating how much progress was achieved

Clickable button used to submit forms

  • autofocus: boolean determining whether button should have focus when page loads
  • disabled: disabled: boolean determining whether button is usable or not
  • form: the associated parent or owner of the button element, as identified by its id attribute
  • formaction: the URL that processes the information submitted by the button, overriding action attribute of button's form
  • formenctype: specifies how to encode the form data that is submitted
    • application/x-www-form-urlencoded: default value
    • multipart/form-data: used if the form contains an input type=file element
    • text/plain: used for debugging purposes
  • formmethod: specifies the HTTP method used to submit the form
    • post: the POST method means the form data is sent as the request body
    • get: the GET method appends form data to the action URL with a ? separator, useful when form has no side-effects
  • formnovalidate: boolean attribute specifies that form should not be validated when it is submitted
  • formtarget: where to display the response after submitting the form
    • _self (default): loads into same browsing context as current
    • _blank: load into a new unnamed browsing context
    • _parent: load into the parent browsing context of the current one
    • _top: load into the top-level browsing context
  • name: name of the button
  • type: default behavior of the button
    • submit: submits form data to the server (default)
    • reset: resets all controls to their initial values (same as input type="reset")
    • button: no default behavior, does nothing when pressed, possible to use for client-side scripts and element events
  • value: defines the value associated with the button's name when the form data is submitted, passing as parameters

Container element that accepts the results of a user action or calculation

+ = 4
  • for: space-separated list of other element ids, indicating that those elements contributed input values to the calculation
  • form: form element to associate with the output (the owner)
  • name: the name of the output element

Interactive

Interactive elements such as expandable areas and dialog boxes

Creates a disclosure widget in which information is only available when toggled open

HTML Tips First default to using elements with semantic meaning. Once exhausting all of those, consider using generic elements like div and span.
  • open: boolean attribute indicating whether or not the details are currently visible

A summary, caption, or legend as part of a details element disclosure box

CSS Tips CSS Grid is the new hotness, and it makes grid layouts super easy to compose and understand.

Dialog box or other interactive component such as an inspector or window

Hello from the Haus! I'm a dialog.

  • open: boolean attribute indicating whether or not the dialog is currently open

Web Components

Elements that allow you to create and use custom elements as if they were regular HTML

Mechanism for holding HTML that will not be rendered immediately when a page is loaded, but can be instantiated during runtime

Placeholder inside a web component containing markup, enabling creation of separate DOM trees

HTML.Haus Website for teaching HTML to everyone. Forever free to do whatever
  • name: the name of the slot used for reference