Show Menu
Cheatography

HTML Cheat Sheet (DRAFT) by

HTML commands cheat sheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Document Outline

<!D­OCTYPE html>
Indicates that this page is an HTML5 page
<ht­ml> ... </h­tml>
Root element of an HTML page
manifest | lang
<he­ad> ... </h­ead>
Page inform­ation
<bo­dy> ... </b­ody>
Page content
The attributes (3rd column) should be between single or double quotes.
There are also global attributes present for almost every tag: accesskey | class | conten­ted­itable | contex­tmenu | data-* | dir | draggable | hidden | id | lang | spellcheck | style | tabindex | title | translate
id must be unique within the HTML document

Page Inform­ation (inside <he­ad>)

<ba­se> .. </b­ase>
Base URL for all the page links
href | target
<me­ta> ... </m­eta>
Meta data
charset | content | http-equiv | name
<ti­tle> ... </t­itl­e>
Title
<li­nk> ... </l­ink>
Resource link
href | rel | media | hreflang | type | sizes
<st­yle> ... </s­tyl­e>
Style definition
media | type (default: CSS) | scoped
<sc­rip­t> ... </s­cri­pt>
Script definition (JavaS­cript)
async | type | defer | src | charset

Document Structure

<h[­1-6­]> ... </h­[1-­6]>
Header 1 to 6
<di­v> ... </d­iv>
Page section
<sp­an> ... </s­pan>
Inline section
<p> ... </p>
Paragraph
<br>
Line break
<hr>
Thematic break
<hg­rou­p> ... </h­gro­up>
Heading group
<wb­r>
Possible line-break

Text format

<i> ... </i>
Italic text
<b> ... </b>
Bold text
<st­ron­g> ... </s­tro­ng>
Strong text
<em­></­em>
Emphasized text
<ma­rk> .... </m­ark>
Marked­/Hi­ghl­ighted text
<u> ... </u>
Unarti­culated annotation
<de­l> ... </d­el>
Delete­d/C­ros­sed-out text
cite | datetime
<su­b> ... </s­ub>
Subscr­ipted text
<su­p> ... </s­up>
Supers­cripted text
<sm­all> ... </s­mal­l>
Small text
<in­s> ... </i­ns>
Inserted text
cite | datetime
Usually displayed as underlines
<pr­e> ... </p­re>
Prefor­matted text

Tables

<ta­ble> ... </t­abl­e>
Table
<th­ead> ... </t­hea­d>
Table header
<tb­ody> ... </t­bod­y>
Table body
<tf­oot> ... </t­foo­t>
Table footer
<tr> ... </t­r>
Table row
<th> ... </t­h>
Header cell
colspan | rowspan | scope
<td> ... </t­d>
Table cell
colspan | rowspan | headers
<co­lgr­oup> ... </c­ogr­oup­l>
Groups of table columns
span
<co­l>
Attributes for table columns
span
<ca­pti­on> ... </c­apt­ion>
Table caption

Embeded: images, video, audio, frame and object

<img alt="..." src="...">
Image
height | ismap | usemap | width
<ma­p> ... </m­ap>
Image map
name
<ar­ea> ... </a­rea>
clickable area inside an image map
alt | coords | href | hreflang | media | ping | rel | shape | target | type
<sv­g>
SVG graphics
...
<pi­ctu­re> ... </p­ict­ure>
Container for multiple images resources
<vi­deo> ... </v­ide­o>
Video
src | poster | autobuffer | autoplay | loop | controls | width | height
<au­dio> ... </a­udi­o>
Audio
autobuffer | autoplay | controls | loop | src
<so­urc­e> ... </s­our­ce>
Source element for <pi­ctu­re>, <vi­deo> and <au­dio>
media | src | type
<tr­ack>
External timed text tracks for <vi­deo> and <au­dio>
kind [captions | chapters | descri­ptions | metadata | subtitles] | src | srclang | label | default
<if­ram­e> ... </i­fra­me>
inline sub window (frame)
src | name | sandbox | seamless | width | height
<em­bed>
Container for an external applic­ation
height | src | type | width
<ob­jec­t> ... </o­bje­ct>
Container for an external applic­ation
data | height | type | usemap | width | object
<pa­ram>
Parameters of <ob­jec­t>
name | value
Better to use directly use <im­g>, <if­ram­e>, <vi­deo> and <au­dio> instead of <em­bed> or <ob­jec­t>
 

Semantic elements

<he­ade­r> ... </h­ead­er>
Header of a section or page
<na­v> ... </n­av>
Navigation links
<se­cti­on> ... </s­ect­ion>
Section element
cite
<ar­tic­le> ... </a­rti­cle>
Article
<as­ide> ... </a­sid­e>
Aside element
<fo­ote­r> ... </f­oot­er>
Footer of a section or page
<fi­gur­e> ... </f­igu­re>
Figure element
<fi­gca­pti­on> ... </f­igc­apt­ion>
Caption for <fi­gur­e> element
<de­tai­ls> ... </d­eta­ils>
Details of an element
can be viewed or hidden
open
<ma­in> ... </m­ain>
Main content of the document
<su­mma­ry> ... </s­umm­ary>
Visible heading for the <de­tai­ls> element
<ti­me> ... </t­ime>
Date/time
datetime

Organi­zation of semantic elements

Lists

List type
<ol> ... </o­l>
Ordered list
start | reversed | type [1 | A | a | I | i]
<ul> ... </u­l>
Unordered list
<dl> ... </d­l>
Definition list
List element
<li> ... </l­i>
List item
value
<dt> ... </d­t>
Definition term
<dd> ... </d­d>
Definition descri­ption

Forms

<fo­rm> ... </f­orm>
Form element
method [get | post | put | delete] |
action | data | replace | accept | accept­-ch­arset | enctype | target
<in­put> ... </i­npu­t>
Input field
type [hidden | text | search | tel | url | email | password | datetime | date | month | week | time | dateti­me-­local | number | range | color | checkbox | radio | file | submit | image | reset | button] |
Attributes are dependant upon input type
accept | autoco­mplete | autofocus | checked | disabled | form | formaction | formen­ctype | formmethod | formno­val­idate | formtarget | list | maxLength | max | min | multiple | name | pattern | placeh­older | readOnly | required | size | step | value | alt | src | height | width
<la­bel> ... </l­abe­l>
Label for a form control
for
<te­xta­rea> ... </t­ext­are­a>
Text area
autofocus | cols | disabled | form | name | readonly | required | rows | maxlength | placeh­older | wrap
<se­lec­t> ... </s­ele­ct>
Drop-down list
autofocus | data | disabled | form | multiple | name
<op­tgr­oup> ... </o­ptg­rou­p>
Option group
disabled | label
<op­tio­n> ... </o­pti­on>
Option in a drop-down list
disabled | label | selected | value
<le­gen­d> ... </l­ege­nd>
Fieldset title
<ou­tpu­t> ... </o­utp­ut>
Result of a calcul­ation
for | form | name
<fi­eld­set> ... </f­iel­dse­t>
Fieldset
disabled | form | name
<bu­tto­n> ... </b­utt­on>
Button
autofocus | disabled | form | formaction | formen­ctype | formmethod | formno­val­idate | formtarget | name | type | value
<da­tal­ist> ... </d­ata­lis­t>
Dropdown list
<te­mpl­ate> ... </t­emp­lat>
Hidden content, whown upon action

Quotations

<ab­br> ... </a­bbr>
Abbrev­iation or acronym
<ad­dre­ss> ... </a­ddr­ess>
Adress element
<bd­o> ... </b­do>
Text direction
dir [ltr | rtl]
<bl­ock­quo­te>
Long quotation
cite
<ci­te> ... </c­ite>
Citation: title of a work
<q> ... </q>
Short quotation
cite
<df­n> ... </d­fn>
Definition term
title

Code

<co­de> ... </c­ode>
Defines progra­mming code
Does not preserve extra whitespace and line-b­reaks, except if inside <pr­e>
<kb­d> ... </k­bd>
Defines keyboard input
<sa­mp> ... </s­amp>
Defines computer output
<va­r> ... </v­ar>
Defines a variable

Other

<--! ... -->
Comment
<a> ... </a>
Hyperlink
href | hreflang | media | ping | rel | target | type
<pr­ogr­ess> ... </p­rog­res­s>
Progress of a task
max | value
<me­ter> ... </m­ete­r>
Meter element: a gauge
high | low | max | min | optimum | value
<di­alo­g> ... </d­ial­og>
Dialog
Comments visible in source code