Creating tables in HTML

Table controls

Table controls are just controlling factors in the make up of the table, these are:

  • BGCOLOR="#000000" - This will give each cell in your table a background colour, it is possible to give each Row a different colour.
  • WIDTH="50%" - This sets the width of the coloumn as a percentage, this one will take up half of the page.
  • BORDER="20" - This sets the width of the border, this setting will give it a border of 20 pixels.
  • CELLSPACING="10" - This sets the vertical and horizontal distance between each cell.
  • CELLPADDING="10" - This sets the vertical space each cell's text has.
  • BORDERCOLOR="#008000" - This will set the colour of the border.
  • ALIGN="CENTER" - This sets where the table will be positioned on the page, you can also use left and right.
Here is a table using some of the controls mentioned above.

<TABLE BORDER="1" WIDTH="50%" BGCOLOR="#F8FF00" ALIGN="CENTER" BORDERCOLOR="#FF0700" CELLSPACING="10" CELLPADDING="10">
<TR>
<TD> ITEM 1 </TD>
<TD> ITEM 2 </TD>
<TD> ITEM 3 </TD>
</TR>
<TR>
<TD> ITEM 4 </TD>
<TD> ITEM 5 </TD>
<TD> ITEM 6 </TD>
</TR>
</TABLE>

ITEM 1 ITEM 2 ITEM 3
ITEM 4 ITEM 5 ITEM 6

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond