Quackit Logo
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Create free Flash websites

HTML Table Code

Print Version

You can use the following HTML code to create a table in your HTML document. You can set the border to zero if you want the table border to be transparent.

You can also check out the HTML Table Generator.

Example HTML Table Code

HTML Code:

<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
<th>Table header</th>
<th>Table header</th>
</tr>
<tr>
<td width="20%">Table cell 1</td><td>Table cell 2</td>
</tr>
</table>

This results in:


Table headerTable header
Table cell 1Table cell 2

Templates

You can use the following template as a basis for your HTML table codes. Simply fill in the blanks or remove uneeded attributes.

Since HTML table code is made up of several tags, each tag is presented separately here.

1. The <table> Tag

For an explanation of all the attributes, see the HTML table tag specifications.

<table
	summary=""
	align=""
	width=""
	dir=""
	class=""
	id=""
	lang=""
	title=""
	style=""
	bgcolor=""
	frame=""
	rules=""
	border=""
	cellspacing=""
	cellpadding=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(td and tr tags go here - see below)

	</table>

2. The <tr> Tag

This tag defines each row in the table.

For an explanation of all the attributes, see the HTML tr tag specifications.

<tr
	dir=""
	class=""
	id=""
	lang=""
	title=""
	style=""
	bgcolor=""
	align=""
	valign=""
	char=""
	charoff=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(td tags go here - see below)

	</tr>

3. The <th> Tag

This tag is optional and defines a header cell for header content.

For an explanation of all the attributes, see the HTML th tag specifications.

<th
	headers=""
	scope=""
	abbr=""
	axis=""
	rowspan=""
	colspan=""
	nowrap=""
	width=""
	height=""
	dir=""
	class=""
	id=""
	lang=""
	title=""
	style=""
	bgcolor=""
	align=""
	valign=""
	char=""
	charoff=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(the table header content goes here)

	</th>

4. The <td> Tag

This tag defines each cell in the table - it's where you put the actual content of the table.

For an explanation of all the attributes, see the HTML td tag specifications.

<td
	headers=""
	scope=""
	abbr=""
	axis=""
	rowspan=""
	colspan=""
	nowrap=""
	width=""
	height=""
	dir=""
	class=""
	id=""
	lang=""
	title=""
	style=""
	bgcolor=""
	align=""
	valign=""
	char=""
	charoff=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

	(the table content goes here)

	</td>

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
$1.99 .info domain names!
© Copyright 2000 - 2010 Quackit.com