Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML

HTML Table Code

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

CodeResult

Table headerTable header
Table cell 1Table cell 2
Table cell 3Table cell 4

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 page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!

Sponsored Link: Design CODE-FREE Websites