29-04-2021



This cheat sheet - or HTML code quick reference - lists the common HTML tags and their attributes, grouped into relevant sections in an easy-to-read format.

What is html? What are tags? - Perhaps check out where to start or what is html first :-)

HTML Cheat Sheet PDF. Save the.pdf version of this interactive page to keep it on your desktop or print it and hang it on the wall and always sneak a peek while coding, composing an article or designing a website. A PDF file is available for every cheat sheet on this website: CSS, JavaScript and others. P:last-of-type last of some type. P:lang (en) p with en language attribute.:not (span) element that's not a span. P:first-child first child of its parent. P:last-child last child of its parent. P:nth-child (2) second child of its parent. P:nth-child (3n+1) nth-child (an + b) formula.

Basic HTML Structure Help | Top
Common Tags for Blogs Help | Top
<h?> heading </h?>Heading (h1 for largest to h6 for smallest)
<p> paragraph </p>Paragraph of Text
<b> bold </b>Make text between tags bold
<i> italic </i>Make text between tags italic
<a href='url'> link name </a>Create a link to another page or website
<div> ... </div>Divide up page content into sections, and applying styles
<img src='filename.jpg'>Show an image
<ul> <li> list </li> </ul>Unordered, bullet-point list
<br>Line Break (force a new line)
<span> red </span>Use CSS style to change text colour
Cheat
Text Formatting Help | Top
<h?> ... </h?>Heading (?= 1 for largest to 6 for smallest, eg h1)
<b> ... </b>Bold Text
<i> ... </i>Italic Text
<u> ... </u>Underline Text
<strike> ... </strike>Strikeout
<sup> ... </sup>Superscript - Smaller text placed below normal text
<sub> ... </sub>Subscript - Smaller text placed below normal text
<small> ... </small>Small - Fineprint size text
<tt> ... </tt>Typewriter Text
<pre> ... </pre>Pre-formatted Text
<blockquote> ... </blockquote>Text Block Quote
<strong> ... </strong>Strong - Shown as Bold in most browsers
<em> ... </em>Emphasis - Shown as Italics in most browsers
<font> ... </font>Font tag obsolete, use CSS. (*)

C++ Syntax Cheat Sheet Pdf

Section Divisions Help | Top
<div> ... </div>Division or Section of Page Content
<span> ... </span>Section of text within other content
<p> ... </p>Paragraph of Text
<br>Line Break
<hr>Basic Horizontal Line
<hr> Tag Attributes:
size='?'Line Thickness in pixels
width='?'Line Width in pixels
width='??%'Line Width as a percentage
color='#??????'Line Colour(*)
align='?'Horizontal Alignment: left, center, right(*)
noshadeNo 3D cut-out
<nobr> ... </nobr>Line Break
Images Help | Top
<img src='url' alt='text'>Basic Image
<img> Tag Attributes:
src='url'URL or filename of image (required!)
alt='text'Alternate Text (required!)
align='?'Image alignment within surrounding text (*)
width='??'Image width (in pixels or %)
height='??'Image height (in pixels or %)
border='??'Border thickness (in pixels) (*)
vspace='??'Space above and below image (in pixels) (*)
hspace='??'Space on either side of image (in pixels) (*)
Html
Linking Tags Help | Top
<a href='url'> link text </a>Basic Link
<a> Tag Attributes:
href='url'Location (url) of page to link to.
name='??'Name of link (name of anchor, or name of bookmark)
target='?'Link target location: _self, _blank, _top, _parent.
href='url#bookmark'Link to a bookmark (defined with name attribute).
href='mailto:email'Link which initiates an email (dependant on user's email client).

C++ Syntax Cheat Sheet

Lists Help | Top
<ol> ... </ol>Ordered List
<ul> ... </ul>Un-ordered List
<li> ... </li>List Item (within ordered or unordered)
<ol type='?'>Ordered list type: A, a, I, i, 1
<ol start='??'>Ordered list starting value
<ul type='?'>Unordered list bullet type: disc, circle, square
<li value='??'>List Item Value (changes current and subsequent items)
<li type='??'>List Item Type (changes only current item)
<dl> ... </dl>Definition List
<dt> ... </dt>Term or phrase being defined
<dd> ... </dd>Detailed Definition of term
Tables Help | Top
<table> ... </table>Define a Table
<table> Tag Attributes:
border='?'Thickness of outside border
bordercolor='#??????'Border Colour
cellspacing='?'Space between cells (pixels)
cellpadding='?'Space between cell wall and content
align='??'Horizontal Alignment: left, center, right(*)
bgcolor='#??????'Background Colour (*)
width='??'Table Width (pixels or %) (*)
height='??'Table Height (pixels or %) (*)
<tr> ... </tr>Table Row within table
<th> ... </th>Header Cell within table row
<td> ... </td>Table Cell within table row
<td> Tag Attributes:
colspan='?'Number of columns the cell spans across (cell merge)
rowspan='?'Number of row a cell spans across (cell merge)
width='??'Cell Width (pixels or %) (*)
height='??'Cell Height (pixels or %) (*)
bgcolor='#??????'Background Colour (*)
align='??'Horizontal Alignment: left, center, right(*)
valign='??'Vertical Alignment: top, middle, bottom(*)
nowrapForce no line breaks in a particular cell
Html syntax cheat sheet template
Frames Help | Top
<frameset> ... </frameset>Define the set of Frames
<frameset> Tag Attributes:
rows='??,??, ...'Define row sizes & number of rows (size in pixels or %)
cols='??,??, ...'Define column sizes & number of columns (size in pixels or %)
noresize='noresize'User cannot resize any frames in frameset
<frame> ... </frame>Define a frame within the frameset
<frame> Tag Attributes:
src='url'Location of HTML File for a frame
name='***'Unique name of frame window
marginwidth='?'Horizontal margin spacing inside frame (pixels)
marginheight='?'Vertical margin spacing inside frame (pixels)
noresize='noresize'Declare all frameset sizes as fixed
scrolling='***'Can the user scroll inside the frame: yes, no, auto
frameborder='?'Frame Border: (1=yes, 2=no)
bordercolor='#??????'Border Colour (*)
<noframes> ... </noframes>Unframed content (for browsers not supporting frames)

Html Syntax Cheat Sheet

Forms Help | Top
<form> ... </form>Form input group decleration
<form> Tag Attributes:
action='url'URL of Form Script
method='***'Method of Form: get, post
enctype='***'For File Upload: enctype='multipart/form-data'
<input> ... </input>Input field within form
<input> Tag Attributes:
type='***'Input Field Type: text, password, checkbox, submit etc.
name='***'Form Field Name (for form processing script)
value='***'Value of Input Field
size='***'Field Size
maxlength='?'Maximum Length of Input Field Data
checkedMark selected field in radio button group or checkbox
<select> ... </select>Select options from drop down list
<select> Tag Attributes:
name='***'Drop Down Combo-Box Name (for form processing script)
size='?'Number of selectable options
multipleAllow multiple selections
<option> ... </option>Option (item) within drop down list
<option> Tag Attributes:
value='***'Option Value
selectedSet option as default selected option
<textarea> ... </textarea>Large area for text input
<textarea> Tag Attributes:
name='***'Text Area Name (for form processing script)
rows='?'Number of rows of text shown
cols='?'Number of columns (characters per rows)
wrap='***'Word Wrapping: off, hard, soft
Special Characters Help | Top
&lt;< - Less-Than Symbol
&gt;> - Greater-Than Symbol
&amp;& - Ampersand, or 'and' sign
&quot;' - Quotation Mark
&copy;© - Copyright Symbol
&trade; - Trademark Symbol
&nbsp; - A space (non-breaking space)
&#??;ISO 8859-1 character - replace ?? with the iso code
Miscellaneous Tags Help | Top
<!-- ... -->Comment within HTML source code
<!DOCTYPE html ... >Document Type Definition (wiki)
<meta> ... </meta>META information tag
<meta> Tag Attributes:
name='***'Meta name: description, keywords, author
http-equiv='***'HTTP Equivalent Info: title, etc.
content='***'Information content
<link>LINK content relationship tag
<link> Tag Attributes:
rel='***'Type of forward relationship
http='url'Location (URL) of object or file being linked
type='***'Type of object or file, eg: text/css
title='***'Link title (optional)
Body Background & Colours Help | Top
<body> Tag Attributes:
background='url'Background Image (*)
bgcolor='#??????' Background Colour(*)
text='#??????' Document Text Colour (*)
link='#??????' Link Colour (*)
vlink='#??????' Visited Link Colour (*)
alink='#??????' Active Link Colour (*)
bgproperties='fixed' Background Properties - 'Fixed' = non-scrolling watermark (*)
leftmargin='?' Side Margin Size in Pixels (Internet Explorer) (*)
topmargin='?' Top Margin Size in Pixels (Internet Explorer) (*)

(*) Important Note:

Html Syntax Cheat Sheet

Tags marked with (*) should still work, but have been superseded by Cascading Style Sheets (CSS), which is now the recommended way to change the font, colour, spacing, border or alignment of HTML elements.

Prev | Top | Next

This HTML cheat sheet includes all HTML5 elements, their attributes, and their DOM interface.

Html Syntax Cheat Sheet Free

ElementDescriptionAttributesDOM InterfaceNew in HTML5?
<!--...-->Specifies a comment None
<!DOCTYPE>Specifies the document type None
<a>Specifies a hyperlinkGlobal Attributes; Event Handlers; href; target; download; rel; hreflang; typeHTMLAnchorElement
<abbr>Specifies an abbreviationGlobal Attributes; Event Handlers; HTMLElement
<address>Specifies an address elementGlobal Attributes; Event Handlers; HTMLElement
<area>Specifies an area inside an image mapGlobal Attributes; Event Handlers; alt; coords; shape; href; target; download; rel; hreflang; typeHTMLAreaElement
<article>Specifies an articleGlobal Attributes; Event Handlers; HTMLElementNEW
<aside>Specifies content aside from the page contentGlobal Attributes; Event Handlers; HTMLElementNEW
<audio>Specifies sound contentGlobal Attributes; Event Handlers; src; crossorigin; preload; autoplay; mediagroup; loop; muted; controlsHTMLAudioElementNEW
<b>Specifies bold textGlobal Attributes; Event Handlers; HTMLElement
<base>Specifies a base URL for all the links in a pageGlobal Attributes; Event Handlers; href; target HTMLBaseElement
<bdi>For bi-directional text formattingGlobal Attributes; Event Handlers; HTMLElementNEW
<bdo>Specifies the direction of text displayGlobal Attributes; Event Handlers; HTMLElement
<blockquote>Specifies a long quotationGlobal Attributes; Event Handlers; cite HTMLQuoteElement
<body>Specifies the body elementGlobal Attributes; Event Handlers; onafterprint; onbeforeprint; onbeforeunload; onhashchange; onmessage; onoffline; ononline; onpagehide; onpageshow; onpopstate; onstorage; onunloadHTMLBodyElement
<br>Inserts a single line breakGlobal Attributes; Event Handlers; HTMLBRElement
<button>Specifies a push buttonGlobal Attributes; Event Handlers; autofocus; disabled; form; formaction; formenctype; formmethod; formnovalidate; formtarget; name; type; value HTMLButtonElement
<canvas>Define graphicsGlobal Attributes; Event Handlers; width; height HTMLCanvasElementNEW
<caption>Specifies a table captionGlobal Attributes; Event Handlers; HTMLTableCaptionElement
<cite>Specifies a citationGlobal Attributes; Event Handlers; HTMLElement
<code>Specifies computer code textGlobal Attributes; Event Handlers; HTMLElement
<col>Specifies attributes for table columns Global Attributes; Event Handlers; span HTMLTableColElement
<colgroup>Specifies groups of table columnsGlobal Attributes; Event Handlers; span HTMLTableColElement
<data>Allows for machine-readable data to be providedGlobal Attributes; Event Handlers; value HTMLDataElementNEW
<datalist>Specifies an 'autocomplete' dropdown listGlobal Attributes; Event Handlers; HTMLDataListElementNEW
<dd>Specifies a definition descriptionGlobal Attributes; Event Handlers; HTMLElement
<del>Specifies deleted textGlobal Attributes; Event Handlers; cite; datetime HTMLModElement
<details>Specifies details of an elementGlobal Attributes; Event Handlers; open HTMLDetailsElementNEW (HTML5.1)
<dfn>Defines a definition termGlobal Attributes; Event Handlers; HTMLElement
<dialog>Specifies that part of an application is interactive.Global Attributes; Event Handlers; open HTMLDialogElementNEW
<div>Specifies a section in a documentGlobal Attributes; Event Handlers; HTMLDivElement
<dl>Specifies a definition listGlobal Attributes; Event Handlers; HTMLDListElement
<dt>Specifies a definition termGlobal Attributes; Event Handlers; HTMLElement
<em>Specifies emphasized text Global Attributes; Event Handlers; HTMLElement
<embed>Specifies external application or interactive contentGlobal Attributes; Event Handlers; src; type; width; height; HTMLEmbedElementNEW
<fieldset>Specifies a fieldsetGlobal Attributes; Event Handlers; disabled; form; name HTMLFieldSetElement
<figcaption>Specifies caption for the figure element.Global Attributes; Event Handlers; HTMLElementNEW
<figure>Specifies a group of media content, and their captionGlobal Attributes; Event Handlers; HTMLElementNEW
<footer>Specifies a footer for a section or pageGlobal Attributes; Event Handlers; HTMLElementNEW
<form>Specifies a form Global Attributes; Event Handlers; accept-charset; action; autocomplete; enctype; method; name; novalidate; target HTMLFormElement
<h1> Specifies a heading level 1Global Attributes; Event Handlers; HTMLHeadingElement
<h2> Specifies a heading level 2Global Attributes; Event Handlers; HTMLHeadingElement
<h3> Specifies a heading level 3Global Attributes; Event Handlers; HTMLHeadingElement
<h4> Specifies a heading level 4Global Attributes; Event Handlers; HTMLHeadingElement
<h5> Specifies a heading level 5Global Attributes; Event Handlers; HTMLHeadingElement
<h6> Specifies a heading level 6Global Attributes; Event Handlers; HTMLHeadingElement
<head>Specifies information about the documentGlobal Attributes; Event Handlers; HTMLHeadElement
<header>Specifies a group of introductory or navigational aids, including hgroup elementsGlobal Attributes; Event Handlers; HTMLElementNEW
<hgroup>Specifies a header for a section or page.

NOTE: This element has been dropped from W3C HTML5 spec but it is still included in WHATWG Living Standard.

Global Attributes; Event Handlers; HTMLElementNEW
<hr> Specifies a horizontal ruleGlobal Attributes; Event Handlers; HTMLHRElement
<html>Specifies an html documentGlobal Attributes; Event Handlers; manifest HTMLHtmlElement
<i>Specifies italic textGlobal Attributes; Event Handlers; HTMLElement
<iframe>Specifies an inline sub window (frame)Global Attributes; Event Handlers; src; srcdoc; name; sandbox; width; height HTMLIFrameElement
<img>Specifies an imageGlobal Attributes; Event Handlers; alt; src; crossorigin; usemap; ismap; width; height HTMLImageElement
<input>Specifies an input fieldGlobal Attributes; Event Handlers; accept; alt; autocomplete; autofocus; checked; dirname; disabled; form; formaction; formenctype; formmethod; formnovalidate; formtarget; height; list; max; maxlength; min; minlength; multiple; name; pattern; placeholder; readonly; required; size; src; step; type; value; width HTMLInputElement
<ins>Specifies inserted textGlobal Attributes; Event Handlers; cite; datetime HTMLModElement
<kbd>Specifies keyboard textGlobal Attributes; Event Handlers; HTMLElement
<keygen>Generates a key pairGlobal Attributes; Event Handlers; autofocus; challenge; disabled; form; keytype; name HTMLKeygenElementNEW
<label>Specifies a label for a form controlGlobal Attributes; Event Handlers; form; for HTMLLabelElement
<legend>Specifies a title in a fieldsetGlobal Attributes; Event Handlers; HTMLLegendElement
<li>Specifies a list itemGlobal Attributes; Event Handlers; value HTMLLIElement
<link>Specifies a resource reference Global Attributes; Event Handlers; href; crossorigin; rel; media; hreflang; type; sizes HTMLLinkElement
<main>Specifies the main content area of an HTML document.Global Attributes; Event Handlers; HTMLElementNEW
<map>Specifies an image map Global Attributes; Event Handlers; name HTMLMapElement
<mark>Specifies marked textGlobal Attributes; Event Handlers; HTMLElementNEW
<menu>Specifies a menu listGlobal Attributes; Event Handlers; type; label; HTMLMenuElementNEW (HTML 5.1)
<menuitem>Specifies a command that a user can invoke from a popup menu.Global Attributes; Event Handlers; type; label; icon; disabled; checked;; radiogroup; default; command HTMLMenuItemElementNEW (HTML 5.1)
<meta>Specifies meta informationGlobal Attributes; Event Handlers; name; http-equiv; content; charset HTMLMetaElement
<meter>Specifies measurement within a predefined rangeGlobal Attributes; Event Handlers; value; min; max; low; high; optimum HTMLMeterElementNEW
<nav>Specifies navigation linksGlobal Attributes; Event Handlers; HTMLElementNEW
<noscript>Specifies a noscript sectionGlobal Attributes; Event Handlers; HTMLElement
<object>Specifies an embedded objectGlobal Attributes; Event Handlers; data; type; typemustmatch; name; usemap; form; width; height HTMLObjectElement
<ol>Specifies an ordered listGlobal Attributes; Event Handlers; reversed; start; type HTMLOListElement
<optgroup>Specifies an option groupGlobal Attributes; Event Handlers; disabled; label HTMLOptGroupElement
<option>Specifies an option in a drop-down listGlobal Attributes; Event Handlers; disabled; label; selected; value HTMLOptionElement
<output>Specifies some types of outputGlobal Attributes; Event Handlers; for; form; name HTMLOutputElementNEW
<p>Specifies a paragraphGlobal Attributes; Event Handlers; HTMLParagraphElement
<param>Specifies a parameter for an objectGlobal Attributes; Event Handlers; name; value HTMLParamElement
<pre>Specifies preformatted textGlobal Attributes; Event Handlers; HTMLPreElement
<progress>Specifies progress of a task of any kindGlobal Attributes; Event Handlers; value; max HTMLProgressElementNEW
<q>Specifies a short quotationGlobal Attributes; Event Handlers; cite HTMLQuoteElement
<rb>Marks the base text component of a ruby annotation.Global Attributes; Event Handlers; NEW
<rp>Used for the benefit of browsers that don't support ruby annotationsGlobal Attributes; Event Handlers; HTMLElementNEW
<rt>Specifies the ruby text component of a ruby annotation.Global Attributes; Event Handlers; HTMLElementNEW
<rtc>Marks a ruby text container for ruby text components in a ruby annotation.Global Attributes; Event Handlers; HTMLElementNEW
<ruby>Specifies a ruby annotation (used in East Asian typography)Global Attributes; Event Handlers; HTMLElementNEW
<s>Indicates text that's no longer accurate or relevant.Global Attributes; Event Handlers; HTMLElement
<samp>Specifies sample computer codeGlobal Attributes; Event Handlers; HTMLElement
<script>Specifies a scriptGlobal Attributes; Event Handlers; src; type; charset; async; defer; crossorigin HTMLScriptElement
<section>Specifies a sectionGlobal Attributes; Event Handlers; HTMLElementNEW
<select>Specifies a selectable listGlobal Attributes; Event Handlers; autofocus; disabled; form; multiple; name; required; size HTMLSelectElement
<small>Specifies small textGlobal Attributes; Event Handlers; HTMLElement
<source>Specifies media resourcesGlobal Attributes; Event Handlers; src; type; media HTMLSourceElementNEW
<span>Specifies a section in a documentGlobal Attributes; Event Handlers; HTMLSpanElement
<strong>Specifies strong textGlobal Attributes; Event Handlers; HTMLElement
<style>Specifies a style definitionGlobal Attributes; Event Handlers; media; type HTMLStyleElement
<sub>Specifies subscripted textGlobal Attributes; Event Handlers; HTMLElement
<summary>Specifies a summary / caption for the <details> elementGlobal Attributes; Event Handlers; HTMLElementNEW (HTML 5.1)
<sup>Specifies superscripted textGlobal Attributes; Event Handlers; HTMLElement
<table>Specifies a tableGlobal Attributes; Event Handlers; border HTMLTableElement
<tbody>Specifies a table bodyGlobal Attributes; Event Handlers; HTMLTableSectionElement
<td>Specifies a table cellGlobal Attributes; Event Handlers; HTMLTableDataCellElement
<template>Declares HTML fragments that can be cloned and inserted in the document by script.Global Attributes; Event Handlers; HTMLTemplateElementNEW
<textarea>Specifies a text areaGlobal Attributes; Event Handlers; autofocus; cols; dirname; disabled; form; maxlength; minlength; name; placeholder; readonly; required; rows; wrap HTMLTextAreaElement
<tfoot>Specifies a table footerGlobal Attributes; Event Handlers; HTMLTableSectionElement
<th>Specifies a table headerGlobal Attributes; Event Handlers; colspan; rowspan; headers; scope; abbr HTMLTableHeaderCellElement
<thead>Specifies a table headerGlobal Attributes; Event Handlers; HTMLTableSectionElement
<time>Specifies a date/timeGlobal Attributes; Event Handlers; datetime HTMLTimeElementNEW
<title>Specifies the document titleGlobal Attributes; Event Handlers; HTMLTitleElement
<tr>Specifies a table rowGlobal Attributes; Event Handlers; HTMLTableRowElement
<track>Specifies a text track for media such as video and audioGlobal Attributes; Event Handlers; default; kind; label; src; srclang HTMLTrackElementNEW
<u>Specifies text with a non-textual annotation.Global Attributes; Event Handlers; HTMLElement
<ul>Specifies an unordered listGlobal Attributes; Event Handlers; HTMLUListElement
<var>Specifies a variableGlobal Attributes; Event Handlers; HTMLElement
<video>Specifies a videoGlobal Attributes; Event Handlers; src; crossorigin; poster; preload; autoplay; mediagroup; loop; muted; controls; width; height HTMLVideoElementNEW
<wbr>Specifies a line break opportunity for very long words and strings of text with no spaces.Global Attributes; Event Handlers; HTMLElementNEW