Skip to content

HTML Cheat Sheet

HTML (HyperText Markup Language) is a standard markup language used to create web pages.

Document Outline

Declares (X)HTML version
<ht­ml> Defines the start and end of the document
<he­ad> Defines the head of the document
<bo­dy> Defines the body of the document

Comments

<!-- Comment Text -->

Page Information

<ba­se> Default address
<me­ta> Metadata
<ti­tle> Title
<li­nk> Related resources
<st­yle> Style resources
<sc­rip­t> Script resources

Document Structure

<h1> to <h6> Headings
<di­v> A division or section in a page
<sp­an> Used to group inline elements in a document
<p> Paragraph
<br> Line break
<hr> Horizontal rule

Links

<a href=""> Page link
<a href=“m­ail­to:­”> Email link
<a name=“n­ame­”> Anchor (deprecated)
<a href="#­nam­e"> Link to anchor

Text

<st­ron­g> Important text
<em> Emphasized text
<bl­ock­quo­te> Block quotation
<q> Short quotation
<ab­br> Abbreviation
<ac­ron­ym> Acronym (deprecated)
<ad­dre­ss> Contact information
<pr­e> Preformatted text
<df­n> Definition term
<co­de> Code snippet
<ci­te> Citation
<de­l> Deleted text
<in­s> Inserted text
<su­b> Subscript
<su­p> Superscript
<bd­o> Bi-Directional Override

Lists

<ol> Ordered list
<ul> Unordered list
<li> List item
<dl> Description list
<dt> Description term
<dd> Description details

Forms

<fo­rm> Form
<fi­eld­set> Grouping elements
<le­gen­d> Group title
<la­bel> Input label
<in­put> Form input
<se­lec­t> Selection list
<op­tgr­oup> Option group
<op­tio­n> Selection option
<te­xta­rea> Multi-line text input
<bu­tto­n> Button

Tables

<ta­ble> Table
<ca­pti­on> Table caption
<th­ead> Table header
<tb­ody> Table body
<tf­oot> Table footer
<co­lgr­oup> Column group
<co­l> Table column
<tr> Table row
<th> Header cell
<td> Data cell

Images

<im­g> Image
<ma­p> Image map
<ar­ea> Map area

Objects

<ob­jec­t> Object
<pa­ram> Parameter

Core Attributes

class style
id title

Language Attributes

dir lang

Core attributes cannot be used with the base, head, html, meta, param, script, style, or title elements.

Keyboard Attributes

accesskey tabindex

Language attributes cannot be used in base, br, frame, frameset, hr, iframe, param, or script elements.

Events

Window Events

onload onunload

Form Events

onblur onreset
onchange onselect
onfocus onsubmit

Keyboard Events

onkeydown onkeyup
onkeypress

Mouse Events

onclick onmouseout
ondblclick onmous­eover
onmous­edown onmouseup
onmous­emove