Adding tables to your website can help you with organizing your content.  Before going through this lesson please first read our class on HTML Basics.

To add a table to your website, the basic HTML code is:

<table>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

which would look like:

row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

How do I create a table with HTML?

To break it down, first we have the tags to start and close the table:

<table>
</table>

Now we will add the first row.  A row is shown with a <tr> tag:

<table>
<tr>

Next, the cells will be added.  A cell is shown with a <td> tag:

<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>

Finally we will close that row, and then start the next row:

<table>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>

You can repeat this to have as many rows and columns as you need.

Adding a Border to your Table

In the example above we created a table with no borders, but you can create a table with borders as well.  Using the above example:

<table>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

All that needs to be added is in the first tag, the border attribute can be input:

<table border ="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

Which would create:

row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

There are other attributes you can add to a table as well such as cellspacing and cellpadding to increase the space between the cells and around the table, but these are the basics to creating a table to your website. 

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}