Wednesday 27 November 2013

Chapter 9: HTML Tables

Chapter 9: HTML Tables

Tables are defined using <table> tag.
Tables are excellent for every website, because with them You can organize and display easy information on a page.
Tables contain 2 tags: <tr> which define rows and each row is divided into data
cells using the <td> tag. <td> stands for "table data". Every cell can contain text, images, links, forms, lists, another tables, and so on.


» EXAMPLE:


Admin Website
Samuel Easilylearnhtml
Adidi Easilylearnhtml
Griffin Easilylearnhtml


A basic table includes the following tags:

Each table starts with <table> tag.

Each row starts with <tr> tag.

Each cell starts with <td> tag.



Now see this three examples for HTML tables.
If you do not specify a border attribute, the table will be displayed without borders. Sometimes this can be useful, but most of the time, we want the borders to show. 


» EXAMPLE 1:


<html>
<body>

<h3>One Column:</h3>
<table border="1">
<tr>
<td>Hi World</td>
</tr>
</table>

</body>
</html>

» Result:

One Column:

Hi World



» EXAMPLE 2:


<html>
<body>

<h3>One Row And Three Columns:</h3>
<table border="1">
<tr>
<td>Hi World</td>
<td>Hi World</td>
<td>Hi World</td>
</tr>
</table>

</body>
</html>

» Result:

One Row And Three Columns:

Hi World Hi World Hi World



» EXAMPLE 3:


<html>
<body>

<h3>Two Rows And Three Columns:</h3>
<table border="1">
<tr>
<td>Hi World</td>
<td>Hi World</td>
<td>Hi World</td>
</tr>
<tr>
<td>Hi World</td>
<td>Hi World</td>
<td>Hi World</td>
</tr>
</table>

</body>
</html>

» Result:

Two Rows And Three Columns:

Hi World Hi World Hi World
Hi World Hi World Hi World


No comments:

Post a Comment