ankitweblogic logo
W e b t u t o r i a l s

HTML Tutorial

Define Website

Define HTML

HTML, Head, Title tag

HTML Body tag

HTML Heading tags

HTML Paragraph tag

HTML Horizontal Line

HTML Hyperlink

HTML Image tag

HTML Font tag

HTML Exercise

HTML Text Direction

HTML Comment

HTML Lists

HTML Marquee tag

HTML Table tag

HTML Table Website

HTML Frame

HTML Iframe

HTML Fieldset tag

HTML Form Elements

HTML Form Exercise

HTML Image Map

HTML Div & Span Tag

CSS Float & Clear

HTML Color Codes

HTML Symbols

HTML Assignment

HTML Table tag

The HTML table allows you to arrange data in a tabular (row and column) format. Data can be text, images, links, etc. The HTML tables are created using the <table> tag in which <tr> tag is used to create table row and <td> tag is used to create table data / table column.

Common attributes of Table tag are:

Attribute Description
Border Specify the width of a border.
Bordercolor Specify border color.
Align To Change table alignment. Possible value can be left, center or right, Default is left.
Cellpadding Cellpadding represents the distance between cell border and the content within a cell.
Cellspacing Cellspacing specifies the space between cells in the table.
Width To change table width in terms of pixel or percentage.
Height To change table height in terms of pixel or percentage.
Colspan To merge two or more columns into a single column.
Rowspan To merge two or more rows into a single row.
Bgcolor Specifies the background color, can be used in table, tr, th, td tag.
Background Specifies the background image for the table.

Some more tags that can be used with table tag are:

<caption> tag defines a table caption, it must be inserted immediately after the <table> tag.

<th> tag is used to specify Table Heading.

Example 1: Table shows the list of developers:

Example 2: Time-Table using table tag:

Example 3: Website layout using table tag:

Exercise 4: Periodic table using table tag: