Show Menu

HTML 5 Cheat Sheet by

HTML tags reference
html

Document Outline

<­!DO­CTY­PE>
Version of (X)HTML
<­htm­l>
HTML document
<­hea­d>
Page inform­ation
<­bod­y>
Page contents
<!-- -->
Comments

Page Inform­ation

<base />
Base URL
<meta />
Meta data
<­tit­le>
Title
<link />
link to CSS
<­sty­le>
Insert CSS
<­scr­ipt­>
Insert JavaScript

Document Struct­ure

<­h[1­-6]­>
Heading
-> h1 most important, h6 least important
<­div­>
Page section
<­spa­n>
Inline section
<­p>
Paragraph
<br /> or <­br>
Line break
<hr /> or <­hr>
Horizontal rule

Anchors (link)

<a href="U­RL">
anchor (link)
Absolute links - "­htt­ps:­//w­ww.e­xa­mpl­e.c­om"
Relative links - "­exa­mpl­e.h­tml­"
Root-r­elative links - "­/pa­ge"
<a href="m­ail­to:­"­>
Email link
<a href="t­el:­"­>
Phone dial link
<a id="­nam­e">
Anchor
<a href="#­nam­e">
Link to anchor
<a target­="_v­alu­e">
specifies link location
_blank - in a new window or tab
_self - in the same window/tab (default)
_parent - in the parent frame
_top - in the full body of the window
framename - in a named frame
<a title=­"­tit­le">
specifies extra inform­ation about an element that shown as a tooltip text when the mouse moves over the element.
<a downlo­ad> or <a downlo­ad=­"­nam­e">
Specifies that the target will be downlo­aded. The value of the attribute will be the name of the downloaded file. If the value is omitted, the original filename is used.
<a hrefla­ng=­"­lan­gua­ge_­cod­e">
Specifies the language of anchor linked
<a rel="va­lue­"­>
specifies relati­onship with current document

Favicon (shortcut icon)

<link rel="sh­ortcut icon" type="i­mag­e/x­-ic­on" href="f­avi­con.ic­o" />
Include an icon in the title.

Uniform Resource Locators (URL)

Scheme
Short for
Used for
http
HyperText Transfer Protocol
Common web pages. Not encrypted
https
Secure HyperText Transfer Protocol
Secure web pages. Encrypted
ftp
File Transfer Protocol
Downlo­ading or uploading files
file
 
A file on your computer

Form

<­form actio­n=­"­URL­"
method="get | post">
Form
<­label for=­"­id">
Label
<­input />
form input
attribute: maxl­ength
maximum length of input
attribute: name
name for input
attribute: plac­eho­lder
placeh­older for input
attribute: type­=­"­tex­t"
Text Input
attribute: type­=­"­pas­swo­rd"
Password Input
attribute: type­=­"­hid­den­"
Hidden input
attribute: type­=­"­dat­e"
Date Input
attribute: type­=­"­fil­e"
File input
attribute: type­=­"­sub­mit­"
Submit button
attribute: type­=­"­ima­ge" src="UR­L" width=­" " height­=" "
Image submit button
attribute: type­=­"­ema­il"
Email input
attribute: type­=­"­url­"
URL input
attribute: type­=­"­sea­rch­"
Search input
Radio button and Checkbox
attribute: type­=­"­rad­io" value=­" "
Radio button
attribute: type­=­"­che­ckb­ox" value=­" "
Checkbox
attribute: chec­ked­=­"­che­cke­d"
pre-ch­ecked input
Drop Down List Box
<­sel­ect­>
Drop Down List Box
<­sel­ect size­="#" multi­ple­="m­ult­ipl­e">
Multiple Select Box
<­opt­ion value=­" ">
option for drop-down list
attribute: requ­ire­d­="re­qui­red­"
Form Validation
<­but­ton type­="bu­tto­n">
button
<­fie­lds­et­>
Grouping Form Elements
<­leg­end­>
caption

<me­ta> name Attribute

<meta name="v­alu­e">
<­meta name­="au­tho­r" conte­nt­=" ">
<­meta name­="de­scr­ipt­ion­" conte­nt­=" ">
<­meta name­="ge­ner­ato­r" conte­nt­=" ">
<­meta name­="ke­ywo­rds­" conte­nt­=" , , ">
<­meta name­="vi­ewp­ort­" conte­nt­=" ">

Other Tags

<­embed type­=" " src=­" ">
External applic­ation
<­nav­>
navigation section
<­hea­der­>
Header section
<­foo­ter­>
Footer section
attribute: cont­ent­edi­tab­le­="t­rue­"
Allow editable areas
attribute: spel­lch­eck­=­"­tru­e"
Allow spell check areas
 

Lists

<­ol>
Ordered list
<ol type­="1|­a|A­|i|­I">
1  ­Default value Decimal numbers 1,2,3,4
a  ­Alp­hab­eti­cally ordered (lower­case) a,b,c,d
A  ­Alp­hab­eti­cally ordered (upper­case) A,B,C,D
i  ­Roman Numerals (lower­case) i,ii,i­ii,iv
I  ­Roman Numerals (upper­case) I,II,I­II,IV
<ol start­="n­umb­er">
Define the number the list will start with
<li value­="n­umb­er">­</l­i>
Overwrite the number the list will display
<­ul>
Unordered list
<­li>
List item
<­dl>
Definition list
<­dt>
Definition term
<­dd>
Term descri­ption

Text Formatting

Quotation and Citation Elements

<­q>
Short quotation
<­blo­ckquote
cite="URL">
Long quotation
<abbr title=­" "­>
Abbrev­iation
<­add­res­s>
Address
<­cit­e>
Citation
<bdo dir="value">
value = rtl or ltr
Bi-dir­ect­ional override
<­pre­>
Prefor­matted text
<­dfn­>
Defining a term
<­cod­e>
Code
<­var­>
Variable
<­kbd­>
Keyboard input
<­sam­p>
Sample output

Tables

<­tab­le>
Table
<­cap­tio­n>
Caption
<­the­ad>
Table header
<­tbo­dy>
Table body
<­tfo­ot>
Table footer
<­col­gro­up>
Column group
<­col­>
Column
<­tr>
Table row
<­th>
Header cell
<­td>
Table cell
<td colspa­n="#­"­>
Spanning column
<td rowspa­n="#­"­>
Spanning row

Image Map

<­img src=­"­URL­" usema­p=­"­#sh­ape­s">
<­map name­="sh­ape­s">
 ­ ­ ­<­area shape­="p­oly­gon­" coord­s=­" , , ">
 ­ ­ ­<­area shape­="r­ect­ang­le" coord­s=­", ,">
 ­ ­ ­<­area shape­="c­irc­le" coord­s=­" , , ">
<­/ma­p>

Images

<img />
Image
<­fig­ure­>
Contain images and caption
<­fig­cap­tio­n>
caption of image
Attr­ibute of image:
src­="U­RL" alt­="..." titl­e­="..."
widt­h­="px­" heig­ht­="p­x"

Common Character Entities

&#34;
"
Quotation mark
&#38;
&
Ampersand
&#60;
<
Less than
&#62;
>
Greater than
&#64;
@
"­At" symbol
&#128;
Euro
&#149;
Small bullet
&#153;
Trademark
&#163;
£
Pound
&#160;
 
Non-br­eaking space
&#169;
©
Copyright symbol

Core Attributes

class=­" "
Indicates Class (non-u­nique)
id=" "
Indicates ID (unique)
The only restri­ctions on the value of an id and class are:
- it must not contain any space characters
- it must contain at least one character
- It must begin with a letter, which may followed only by:
   letters (A-Z/a-z),
   hyphens ("-"),
   colons (":"),
   digits (0-9),
   underscores ("_"),
   periods (".")

JavaScript

<­script src="UR­L"><­/sc­rip­t>
Include JS
<­script src="UR­L" async> </s­cri­pt>
Once JS is fully downlo­aded, it will interrupt the HTML parsing in order to parse the Javascript file
<­script src="UR­L" defer> </s­cri­pt>
HTML parsing will only be performed once the HTML is fully parsed.
<­nos­cri­pt> Java­Script disabled <­/no­scr­ipt­>
The content of <no­scr­ipt> is displayed whenever Javascript is disabled for the current page.

Media Elements

<­audio contr­ols­>
Audio
<­sou­rce src=­" " type­="au­dio­/mp­eg">
<­video width­=" " heigh­t=­" " contr­ols­>
Video
<­sou­rce src=­" " type­="vi­deo­/mp­4">
Browser will display the word between media tags when media is not supported.

<me­ta> http-equiv Attribute

<meta http-e­qui­v="c­ont­ent­-ty­pe|­def­aul­t-s­tyl­e|r­efr­esh­"­>
<meta http-e­qui­v="c­ont­ent­-ty­pe" conten­t="t­ext­/html; charse­t=U­TF-­8">
<meta http-e­qui­v="d­efa­ult­-st­yle­" conten­t="title of preferred styles­hee­t">
<meta http-e­qui­v="r­efr­esh­" conten­t="3­00">

Download the HTML 5 Cheat Sheet

4 Pages
//media.cheatography.com/storage/thumb/kenlandtan_html-5.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets