Creating Tables

This is first column This is second column

Table with 2 row 2 col Now we will try to create a table with 2 row and 2 cols each

Example Code:

This is 1st row 1st column This is 1st row 2nd column
This is 2nd row 1st column This is 2nd row 2nd column

This is first column This is second column

Table with background image Now we will try to create a table with one column having a background image

Example Code:

This is 1st row 1st column This is 1st row 2nd column
This is 2nd row 1st column This is 2nd row 2nd column

Nice background

Table Size We can set the size of the table based of pixels or percentage. First we will see how to set size based on pixels. The attribute width and height will be used.

Example Code:

This is 1st row 1st column This is 1st row 2nd column
This is 2nd row 1st column This is 2nd row 2nd column

Nice background

Now we have set the total table width as 300 and height as 100 and split them as 30 to first row and 70 to second row

Aligning Content (text) in columns The content (text,image,etc..) inside the columns can be aligned horizontally using the tag attribute "align" The content (text,image,etc..) inside the columns can be aligned vertically using the tag attribute "valign" ALIGN can take the values as LEFT/RIGHT/CENTER VALIGN can take the values as TOP/BOTTOM/CENTER

Example Code:

center right
top Bottom

Table inside table Many a times we will be using table inside tables Now we will create two row with three columns. The 2nd row, 2nd column will be split again to a table with two rows, two cols. Also we will be using the attributes cellpadding and cellspacing to handle table space.

Example Code:

First Row First Row First Row
Second Row

Inner Table Inner Table
Inner Table Inner Table
Second Row

Enjoy this page? Please pay it forward. Here's how...

Would you prefer to share this page with others by linking to it?

  1. Click on the HTML link code below.
  2. Copy and paste it, adding a note of your own, into your blog, a Web page, forums, a blog comment, your Facebook account, or anywhere that someone would find this page valuable.