HTML Tables

Tables are very useful to arrange in HTML and they are used very frequently by almost all web developers. HTML Tables are just like spreadsheets and they are made up of rows and columns.
You will create a table in HTML/XHTML by using <table> tag. Inside <table> element the table is written out row by row. A row is contained inside a <tr> tag, Which stands for table row. And each cell is then written inside the row element using a <td> tag, which stands for table data.

Example:

 

This will produce the following output:

abc def
pqr xyz

1. Table Heading – The <th> Element ( HTML Tables )

Table heading can be defined using <th> element. This tag will be put to replace <td> tag which is used to represent actual data. Normally you will put your top row as table heading as shown below, otherwise you can use <th> element at any place:

 

2. table rows – The <tr> Element

This is HTML Tables Element which is used to make the row for the Table as we know that a table contains rows and columns. Have a look at the following code for the HTML roes ( i.e <tr> tag ). The lines highlighted are using <tr> tag in the code

 

3. Table Data – The <td> Element

After we know about the <tr> tag, we have to know about the <td> tag which is used to make the columns in the tables. you can use the above example to understand the <td> tag.

You can also use the css for HTML tags from this link click here to learn css

Here is the complete code for a good HtML Tables example

Try it