How to create tables using HTML?

Well, it could be confusing to create tables, if you don’t know how. Creating tables is very easy once you learn how to create tables using HTML. Organizing your data into tables, give an elegant look to your website. Also giving your table a final touch adds to the beauty. So in this post, lets learn how to create a simple table.

Introduction

First you need to know some HTML tags. They are :

Tag Description
<table> , </table Opening and closing tags
<tr> , </tr> Represents a table row
<td> </td> Represents a Coloumn

Now lets design a table like above of our own.


<table>
 <tr> <td>A</td> <td>B</td> <td>C</td> </tr>
 <tr> <td>X</td> <td>Y</td> <td>Z</td> </tr>
 </table>
  

And this is what it will look when published :

A B C
X Y Z

Adding table border

Adding a table border is pretty easy too. It just involves adding an extra code in the above table.


<table  border="2">
 <tr>
 <td>A</td>
 <td>B</td>
 <td>C</td>
 </tr>
 <tr>
 <td>X</td>
 <td>Y</td>
 <td>Z</td>
 </tr>
 </table>

Notice the “2” represents the thickness of the border. If you had set it to “0” then there would have been no border at all. If you wanted it very thick then you could set it to 8, for example. So now your table will look like this :You can add more changes to this table by attributing more html tags. Hope you enjoyed this post. Leave your valuable comments, or consider sharing this post.