Saturday, October 19, 2013

Filled Under:

How to create tables in an HTML document.

Hey everyone how are you
Today we will learn how to make tables in HTML.
A table is made so that you can display your data in a format in rows and columns.Tables are defined by the <table> tag and inside this tag you can start making rows of the table.
So lets get started,a table is divided into rows and each row is divided into data cells.
Table row can be defined by <tr></tr> and a table data cell is defined by <td></td>
<tr> stands for table row and <td> stands for table data.
You can put images,forms,lists etc in the table data.
<th> it defines the current cell as a table header.You can place the heading of the row in this <th> tag.

<html>
<body>

<table border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
<tr>
<td>Konain</td>
<td>Shehzad</td>
</tr>
<tr>
<td>Arnold</td>
<td>Schwarzenegger</td>
</tr>
</table>

</body>
</html>

As you can notice here that we started with the <table> tag and inside it we write border="1" this defines the border of the table you are creating.
Then comes the <tr> tag which means that now we want to add a row and inside that row we gave the headings first name and last name,after giving the headings you will have to close the </tr> tag.What is opened must be closed.
Now you can notice that i have given the <tr>tag to give a row <tr> stands for table row and then <td> tag table data,and inside it i have written the data which i want to display,in this case i have displayed 2 name.
After putting data in the <td> tag i gave the </tr> tag to close it and then i closed the <table> tag by using </table>
This is how this code will give the output when you will try it.







0 comments:

Post a Comment