HTML Table
HTML Tables is used to preset data in rows and columns format. A Table is the collection of rows and rows is the collection of columns. <tr> stands for table rows.To add a row in a table table row tags are used. <td> is used to put the column inside the row
<table>
<tr> //row start
<td> col1 </td><td> col2 </td>
</tr> //row end
</table>
| col1 | col2 |
In the above eg the output don't look like a table format . Its because there is no border . On Using border attribute . the border will appear .
Eg
<table border="2px">
<tr> //row start
<td> col1 </td><td> col2 </td>
</tr> //row end
</table>
| col1 | col2 |
How to merge table column
When you want to merge 2 or more then 2 column(cell) , use colspan Property of
or <th colspan=”2″><br />
<table border="1">
<tr> //row start
<th colspan="2"> User Details</th>
</tr> //row end
<tr> //row start
<th>dophptalks.blogspot.in</th><th>AhmedWebTech112@gmail.com</th>
</tr> //row end
<tr> //row start
<th>dophptalks.blogspot.in</th><th>AhmedWebTech112@gmail.com</th>
</tr> //row end
</table>
| User Details | |
|---|---|
| Name | |
| dophptalks.blogspot.in | AhmedWebTech112@gmail.com |
| dophptalks.blogspot.in | AhmedWebTech112@gmail.com |
How to merge table row
When you want to merge 2 or more then 2 row(line) , use rowspan Property of
or <th rowspan=”2″><br />
<table border="1">
<tr>
<td rowspan="2">doPhpTalks</td>
<td>best blog;</td>
</tr>
<tr>
<td>Ahmedwebtech</td>
</tr>
</table>
| doPhpTalks | best blog; |
| Ahmedwebtech |
Nested Table
Nested table means how to use table inside a table. Multiple times you need to use table inside a table. when you want to use a table inside a table write the syntax of table in between your cell i.e eighter <td> or <th>.
<table border="1" bgcolor="gray" width="200" height="200"> <tr> <th> <table align="center" border="1" bgcolor="#F8F8F8" width="100" height="100"> <tr> <th>Inner Table</th> </tr> </table> </th> </tr> </table>
|
|---|
No comments:
Post a Comment