Leakbali
w3 Tutorial, Web Tutorial
Switch to English Bahasa Indonesia 
Register   Login

HTML - Tables


Tables are defined with the <table> tag.

A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the &tl;td&tg; tag). td stands for "table data," and holds the content of a data cell. A &tl;td&tg; tag can contain text, links, images, lists, forms, other tables, etc.

Table Example:

<table>
<tr>
<td>Color>/td><td>Black</td>
</tr>
<tr>
<td>Color>/td><td>White</td>
</tr>
<tr>
<td>Fruits</td><td>Apple</td>
</tr>
<tr>
<td>Fruits</td><td>Strawberry</td>
</tr>
</table>
The HTML Code above looks in browser:
ColorBlack
ColorWhite
FruitsApple
FruitsStrawberry
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.

To display a table with borders, specify the border attribute:
<table border="1">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table> 
Header information in a table are defined with the <th> tag.

The text in a th element will be bold and centered.
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<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>
How the HTML code above looks in a browser:
Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
TagsDescription
<table>Defines a table
<th>Defines a header
<tr>Defines a row
<td>Defines a cell
<caption>Defines a table caption
<colgroup>Defines a column in a table for formatting
<col>Defines attribute values for one or more columns in a table
<thead>Groups the header content in a table
<tfoot>Groups the footer content in a table

References

About Us

Home
About Us
Contact Us
Sitemap

Tools

Google PageRank
Alexa Rank
Keywords Density

Accounts

Register Account
Login
Valid XHTML 1.0 TransitionalValid CSS!
Web Directory


2006 - 2012 © Leakbali.com - Free Web Tutorial, Free Web Articles, Web Sharing, Source Codes, Web References