A reminder of HTML elements. Contribute to gendx/html-cheat-sheet development by creating an account on GitHub.

  1. Learning HTML is hard enough, without having to memorize dozens of tags & attributes. That’s why we’ve put together this handy HTML cheat sheet for you to print out & keep by your side as you learn to code HTML, CSS & javascript. It makes the process of learning to code & building your first website much easier. Download The PDF Now.
  2. The element defines a section in a document. According to W3C's HTML documentation: 'A section is a thematic grouping of content, typically with a heading.'

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 :-)

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
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. (*)
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) (*)
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).
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 5 Code Cheat Sheet

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)
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:

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 cheatsheet glances over some of the common syntax of F# 3.0. If you have any comments, corrections, or suggested additions, please open an issue or send a pull request to https://github.com/dungpa/fsharp-cheatsheet.

Comments

Block comments are placed between (* and *). Line comments start from // and continue until the end of the line.

XML doc comments come after /// allowing us to use XML tags to generate documentation.

Strings

F# string type is an alias for System.String type.

Use verbatim strings preceded by @ symbol to avoid escaping control characters (except escaping ' by ').

We don't even have to escape ' with triple-quoted strings.

Backslash strings indent string contents by stripping leading spaces.

Basic Types and Literals

Most numeric types have associated suffixes, e.g., uy for unsigned 8-bit integers and L for signed 64-bit integer.

Other common examples are F or f for 32-bit floating-point numbers, M or m for decimals, and I for big integers.

See Literals (MSDN) for complete reference.

Functions

The let keyword also defines named functions.

Pipe and composition operators

Sheet

Pipe operator |> is used to chain functions and arguments together. Double-backtick identifiers are handy to improve readability especially in unit testing:

This operator is essential in assisting the F# type checker by providing type information before use:

Composition operator >> is used to compose functions:

Recursive functions

The rec keyword is used together with the let keyword to define a recursive function:

Mutually recursive functions (those functions which call each other) are indicated by and keyword:

Pattern Matching

Pattern matching is often facilitated through match keyword.

In order to match sophisticated inputs, one can use when to create filters or guards on patterns:

Pattern matching can be done directly on arguments:

or implicitly via function keyword:

For more complete reference visit Pattern Matching (MSDN).

Collections

Lists

A list is an immutable collection of elements of the same type.

Basic Html Commands Cheat Sheet

Arrays

Arrays are fixed-size, zero-based, mutable collections of consecutive data elements.

Sequences

A sequence is a logical series of elements of the same type. Individual sequence elements are computed only as required, so a sequence can provide better performance than a list in situations in which not all the elements are used.

Higher-order functions on collections

The same list [ 1; 3; 5; 7; 9 ] or array [| 1; 3; 5; 7; 9 |] can be generated in various ways.

  • Using range operator ..

  • Using list or array comprehensions

  • Using init function

Lists and arrays have comprehensive sets of higher-order functions for manipulation.

  • fold starts from the left of the list (or array) and foldBack goes in the opposite direction

  • reduce doesn't require an initial accumulator

  • map transforms every element of the list (or array)

  • iterate through a list and produce side effects

All these operations are also available for sequences. The added benefits of sequences are laziness and uniform treatment of all collections implementing IEnumerable<'T>.

Tuples and Records

A tuple is a grouping of unnamed but ordered values, possibly of different types:

The first and second elements of a tuple can be obtained using fst, snd, or pattern matching:

Records represent simple aggregates of named values, optionally with members:

Records can be augmented with properties and methods:

Records are essentially sealed classes with extra topping: default immutability, structural equality, and pattern matching support.

Discriminated Unions

Discriminated unions (DU) provide support for values that can be one of a number of named cases, each possibly with different values and types.

F# Core has a few built-in discriminated unions for error handling, e.g., Option and Choice.

Single-case discriminated unions are often used to create type-safe abstractions with pattern matching support:

Exceptions

The failwith function throws an exception of type Exception.

Exception handling is done via try/with expressions.

The try/finally expression enables you to execute clean-up code even if a block of code throws an exception. Here's an example which also defines custom exceptions.

Classes and Inheritance

This example is a basic class with (1) local let bindings, (2) properties, (3) methods, and (4) static members.

Call a base class from a derived one.

Upcasting is denoted by :> operator.

Dynamic downcasting (:?>) might throw an InvalidCastException if the cast doesn't succeed at runtime.

Interfaces and Object Expressions

Declare IVector interface and implement it in Vector'.

Another way of implementing interfaces is to use object expressions.

Active Patterns

Complete active patterns:

Parameterized active patterns:

Partial active patterns share the syntax of parameterized patterns but their active recognizers accept only one argument.

Compiler Directives

Load another F# source file into FSI.

Reference a .NET assembly (/ symbol is recommended for Mono compatibility).

Include a directory in assembly search paths.

Other important directives are conditional execution in FSI (INTERACTIVE) and querying current directory (__SOURCE_DIRECTORY__).

val result : bool
Full name: fsharpcheatsheet.result

The `let` keyword defines an (immutable) value
val hello : string
Full name: fsharpcheatsheet.hello

Create a string using string concatenation
Checker
val verbatimXml : string
Full name: fsharpcheatsheet.verbatimXml
val tripleXml : string
Full name: fsharpcheatsheet.tripleXml
val b : byte
Full name: fsharpcheatsheet.b
val l : int64
Full name: fsharpcheatsheet.l
val f : float
Full name: fsharpcheatsheet.f
val bi : System.Numerics.BigInteger
Full name: fsharpcheatsheet.bi
val negate : x:int -> int
Full name: fsharpcheatsheet.negate
val square : x:int -> int
Full name: fsharpcheatsheet.square
val print : x:int -> unit
Full name: fsharpcheatsheet.print
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val squareNegateThenPrint : x:int -> unit
Full name: fsharpcheatsheet.squareNegateThenPrint
val ( square, negate, then print ) : x:int -> unit
Full name: fsharpcheatsheet.( square, negate, then print )
val sumOfLengths : xs:string [] -> int
Full name: fsharpcheatsheet.sumOfLengths
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = System.String
Full name: Microsoft.FSharp.Core.string
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
Full name: Microsoft.FSharp.Collections.Array.map
property System.String.Length: int
val sum : array:'T [] -> 'T (requires member ( + ) and member get_Zero)
Full name: Microsoft.FSharp.Collections.Array.sum
val squareNegateThenPrint' : (int -> unit)
Full name: fsharpcheatsheet.squareNegateThenPrint'
val fact : x:int -> int
Full name: fsharpcheatsheet.fact
val even : x:int -> bool
Full name: fsharpcheatsheet.even
val odd : x:int -> bool
Full name: fsharpcheatsheet.odd
val fib : n:int -> int
Full name: fsharpcheatsheet.fib
val sign : x:int -> int
Full name: fsharpcheatsheet.sign
val fst' : x:'a * 'b -> 'a
Full name: fsharpcheatsheet.fst'
val fib' : _arg1:int -> int
Full name: fsharpcheatsheet.fib'

Similar to `fib`; using `function` for pattern matching
val list1 : string list
Full name: fsharpcheatsheet.list1
val list2 : string list
Full name: fsharpcheatsheet.list2
val list3 : string list
Full name: fsharpcheatsheet.list3
val sum : list:int list -> int
Full name: fsharpcheatsheet.sum
Multiple items
val list : int list
--------------------
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
val array1 : string []
Full name: fsharpcheatsheet.array1
val first : string
Full name: fsharpcheatsheet.first
val seq1 : seq<int>
Full name: fsharpcheatsheet.seq1
Multiple items
val seq : sequence:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
val ys : int []
Full name: fsharpcheatsheet.ys
val zs : int list
Full name: fsharpcheatsheet.zs
Multiple items
module List
from Microsoft.FSharp.Collections
--------------------
type List<'T> =
| ( [] )
| ( :: ) of Head: 'T * Tail: 'T list
interface IEnumerable
interface IEnumerable<'T>
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
static member Cons : head:'T * tail:'T list -> 'T list
static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
val init : length:int -> initializer:(int -> 'T) -> 'T list
Full name: Microsoft.FSharp.Collections.List.init
val fold : folder:('State -> 'T -> 'State) -> state:'State -> array:'T [] -> 'State
Full name: Microsoft.FSharp.Collections.Array.fold
val sprintf : format:Printf.StringFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val last : xs:'a list -> 'a
Full name: fsharpcheatsheet.last
val reduce : reduction:('T -> 'T -> 'T) -> list:'T list -> 'T
Full name: Microsoft.FSharp.Collections.List.reduce
val ys' : int []
Full name: fsharpcheatsheet.ys'
val iter : action:('T -> unit) -> list:'T list -> unit
Full name: Microsoft.FSharp.Collections.List.iter
val x : int * string
Full name: fsharpcheatsheet.x
val y : string * string * string
Full name: fsharpcheatsheet.y
val b' : string
Full name: fsharpcheatsheet.b'
val fst : tuple:('T1 * 'T2) -> 'T1
Full name: Microsoft.FSharp.Core.Operators.fst
val snd : tuple:('T1 * 'T2) -> 'T2
Full name: Microsoft.FSharp.Core.Operators.snd
val print' : 'a * 'b -> unit
Full name: fsharpcheatsheet.print'
val a : 'a
type Person =
{Name: string;
Age: int;}
member Info : string * int
Full name: fsharpcheatsheet.Person
Person.Age: int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
val paulsTwin : Person
Full name: fsharpcheatsheet.paulsTwin
member Person.Info : string * int
Full name: fsharpcheatsheet.Person.Info
val isPaul : person:Person -> bool
Full name: fsharpcheatsheet.isPaul
type Tree<'T> =
| Node of Tree<'T> * 'T * Tree<'T>
| Leaf
Full name: fsharpcheatsheet.Tree<_>
union case Tree.Node: Tree<'T> * 'T * Tree<'T> -> Tree<'T>
val depth : _arg1:Tree<'a> -> int
Full name: fsharpcheatsheet.depth
val r : Tree<'a>
val max : e1:'T -> e2:'T -> 'T (requires comparison)
Full name: Microsoft.FSharp.Core.Operators.max
val optionPatternMatch : input:int option -> unit
Full name: fsharpcheatsheet.optionPatternMatch
union case Option.Some: Value: 'T -> Option<'T>
type OrderId = | Order of string
Full name: fsharpcheatsheet.OrderId
val orderId : OrderId
Full name: fsharpcheatsheet.orderId
val divideFailwith : x:int -> y:int -> int
Full name: fsharpcheatsheet.divideFailwith
val failwith : message:string -> 'T
Full name: Microsoft.FSharp.Core.Operators.failwith
val divide : x:int -> y:int -> int option
Full name: fsharpcheatsheet.divide
Multiple items
type DivideByZeroException =
inherit ArithmeticException
new : unit -> DivideByZeroException + 2 overloads
Full name: System.DivideByZeroException
--------------------
System.DivideByZeroException() : unit
System.DivideByZeroException(message: string) : unit
System.DivideByZeroException(message: string, innerException: exn) : unit
exception InnerError of string
Full name: fsharpcheatsheet.InnerError
exception OuterError of string
Full name: fsharpcheatsheet.OuterError
val handleErrors : x:'a -> y:'a -> unit (requires equality)
Full name: fsharpcheatsheet.handleErrors
val y : 'a (requires equality)
val raise : exn:System.Exception -> 'T
Full name: Microsoft.FSharp.Core.Operators.raise
Multiple items
type Vector =
new : x:float * y:float -> Vector
member Scale : s:float -> Vector
member Mag : float
member X : float
member Y : float
static member ( + ) : a:Vector * b:Vector -> Vector
Full name: fsharpcheatsheet.Vector
--------------------
new : x:float * y:float -> Vector
Multiple items
val float : value:'T -> float (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.float
--------------------
type float = System.Double
Full name: Microsoft.FSharp.Core.float
--------------------
type float<'Measure> = float
Full name: Microsoft.FSharp.Core.float<_>
val mag : float
val sqrt : value:'T -> 'U (requires member Sqrt)
Full name: Microsoft.FSharp.Core.Operators.sqrt
member Vector.X : float
Full name: fsharpcheatsheet.Vector.X
member Vector.Y : float
Full name: fsharpcheatsheet.Vector.Y
member Vector.Mag : float
Full name: fsharpcheatsheet.Vector.Mag
Basic html commands cheat sheet
member Vector.Scale : s:float -> Vector
Full name: fsharpcheatsheet.Vector.Scale
val a : Vector
property Vector.X: float
Multiple items
type Animal =
new : unit -> Animal
member Rest : unit -> unit
Full name: fsharpcheatsheet.Animal
--------------------
new : unit -> Animal
member Animal.Rest : unit -> unit
Full name: fsharpcheatsheet.Animal.Rest
Multiple items
type Dog =
inherit Animal
new : unit -> Dog
member Run : unit -> unit
Full name: fsharpcheatsheet.Dog
--------------------
new : unit -> Dog
member Dog.Run : unit -> unit
Full name: fsharpcheatsheet.Dog.Run
val animal : Animal
Full name: fsharpcheatsheet.animal
val shouldBeADog : Dog
Full name: fsharpcheatsheet.shouldBeADog
type IVector =
interface
abstract member Scale : float -> IVector
end
Full name: fsharpcheatsheet.IVector
abstract member IVector.Scale : float -> IVector
Full name: fsharpcheatsheet.IVector.Scale
Multiple items
type Vector' =
interface IVector
new : x:float * y:float -> Vector'
member X : float
member Y : float
Full name: fsharpcheatsheet.Vector'
--------------------
new : x:float * y:float -> Vector'
override Vector'.Scale : s:float -> IVector
Full name: fsharpcheatsheet.Vector'.Scale
member Vector'.X : float
Full name: fsharpcheatsheet.Vector'.X
member Vector'.Y : float
Full name: fsharpcheatsheet.Vector'.Y
type ICustomer =
interface
abstract member Age : int
abstract member Name : string
end
Full name: fsharpcheatsheet.ICustomer
abstract member ICustomer.Name : string
Full name: fsharpcheatsheet.ICustomer.Name
abstract member ICustomer.Age : int
Full name: fsharpcheatsheet.ICustomer.Age
val createCustomer : name:string -> age:int -> ICustomer
Full name: fsharpcheatsheet.createCustomer
val age : int
property ICustomer.Age: int
val testNumber : i:int -> unit
Full name: fsharpcheatsheet.testNumber
active recognizer Even: int -> Choice<unit,unit>
Full name: fsharpcheatsheet.( |Even|Odd| )

Html Formatting Cheat Sheet

active recognizer Odd: int -> Choice<unit,unit>
Full name: fsharpcheatsheet.( |Even|Odd| )
val fizzBuzz : _arg1:int -> string
Full name: fsharpcheatsheet.fizzBuzz

Semantic Html Cheat Sheet Pdf

active recognizer DivisibleBy: int -> int -> unit option
Full name: fsharpcheatsheet.( |DivisibleBy|_| )