HTML Tag Sheet
Structural / Basic tags
<body> </body> Defines the body of web page
<body bgcolor="pink"> Sets the background colour of web page
<body text="black"> Sets the colour of the body text
<head> </head> Contains information about document
<html> </html> Starts and end a web page
<title> </title> Defines a title for the document
<!-- --> Comment
Formatting Tags
<p></p> Creates a new paragraph
<p align="left"> Aligns a paragraph to the left (default), can also be right, or center
<br/> Inserts a line break
<ol></ol> Creates a numbered list
<ol type="A", "a", "I",
Defines the type of numbering used
"i","1"></ol>
<ul></ul> Creates a bulleted list
<ul type="disc",
Defines the type of bullets used
"square", "circle"></ul>
Inserted before each list item, and adds a number or symbol depending upon the
<li></li>
type of list selected
Text Tags
<h1></h1> Creates the largest heading
<h6></h6> Creates the smallest heading
<b></b> Creates bold text
<i></i> Creates italic text
<u></u> Creates underlined text
<font size="3"> </font> Sets size of font, from 1 to 7
<font color="green"> </font> Sets font colour
<font face="Times New Roman"> </font> Sets font type
Graphics Tags
<img src="name"> Adds an image
<img src="name" align="left"> Aligns an image: can be left, right, center; bottom, top, middle
<img src="name" border="1"> Sets width of border around an image
<img src="name" width="200" height ="200"> Sets the height and width of an image
Displays alternative text when the mouse hovers over the
<img src="name" alt="alternative text">
image
<hr/> Inserts a horizontal line
<hr size="3"/> Sets size (height) of line
<hr width="80%"/> Sets width of line, in percentage or absolute value
<hr color="Red"/> Sets the colour of the line
Links Tags
<a href="URL"> link text </a> Creates a hyperlink displaying the link text
<a href="URL"> <img src="name"> </a> Creates an image link
<a name="NAME"> </a> Creates a target location
<a href="#NAME"> </a> Links to a target location created somewhere else in the document
Table Tags
<table></table> Creates a table
<tr></tr> Creates a row in a table
<td></td> Creates a cell in a table
<th></th> Creates a table header (a row with bold, centred text)
<table border="1"> Sets the width of the border around the table cells
<table cellspacing="1"> Sets the space between the table cells
<table cellpadding="1"> Sets the space between a cell’s border and its contents
<table width="50%"> Sets width of table, in percentage or number of pixels
<tr align="left"> Sets alignment for cell(s) (left, can also be center, or right)
<tr valign="top"> Sets vertical alignment for cell(s) (top, can also be middle, or bottom)
<td colspan="2"> Sets number of columns a cell should span
<td rowspan="4"> Sets number of rows a cell should span