How to Make a Table With HTML

by eHow Computers Editor

Tables can let you view an array of data in HTML. The table tags are designed to make groups of information look better and to allow users to get borders around lists. A table in HTML is created by using several tags in the right order.

Begin with the tag < table >.

Next, use < tr > to open a row.

Within < tr >, use < td > to open a column.

Enter the text in the first column. Then use < /td > to end your column and go on to the next one.

Use < td > to open your second column and enter the text. Then use < /td > and < /tr > to end your column and your row. At this point, if you have a row with two columns containing the text "June" and "July", your code will look like this: < table > < tr > < td > June < /td> < td > July < /td > < /tr >.

If you want a second row, use < tr > to open your row and follow the same tag instructions from above.

When your table is done, use < /table > to close it.

Within the table structure, tags are placed to create a border. The thickness of the border is indicated by a variable x as follows: < table border = x >. Put this just after the < table > command.

Cellpadding is how many pixels are between table text and the border. Put this command after the border command: < cellpadding = x >.

Tips

  • check Don't include more columns on the second row than you added on the first. Asymmetrical tables can cause problems.
  • check When making tables, also consider the style tags such as border, cell space and others that determine what the table border will look like. These usually take values related to number of pixels. Guides are available online.

Warning

  • close Due to formatting demands, the code used here has spaces between the command text and the brackets . Your code should not have space in between a bracket and the next character.