Lecture-7_Table_ (2)
Lecture-7_Table_ (2)
Tables in HTML
HTML Tables
<tr>
<td>Archit</td>
<td>MCA</td>
</tr>
<tr>
<td>kartik</td>
<td>M.Tech</td>
</tr>
</table>
</body>
Tables Border Attribute
Example:-
<body>
<table border="1">
<tr>
<td>Neeraj</td>
<td>BCA</td>
</tr>
<tr>
<td>Archit</td>
<td>MCA</td>
</tr>
<tr>
<td>kartik</td>
<td>M.Tech</td>
</tr>
</table>
</body>
Table Heading - The
<th> Element:
<BODY>
<table border=5>
<caption><b> Admission 2009-2010</b></caption>
<tr><td>Computer Science <td>9 <td>18 <td>20 <td>20
<tr><td>Commerce <td>17 <td>18 <td>27 <td>24
<tr><td>Physics <td>9 <td>18 <td>20 <td>20
<tr><td>Chemisrty <td>17 <td>18 <td>27 <td> 
</table>
</BODY>
</HTML>
Table Cellpadding and Cellspacing Attribute
• There are two attributes called cellpadding and
cellspacing which you will use to adjust the white
space in your table cell.
• Cellspacing defines the distance among each
individual cells, while cellpadding represents the
distance (in pixel value) between cell borders and
the content within it.
• Example:-
<body>
<table border="1" cellpadding="5"
cellspacing="5">
<Caption>Salary Detail</caption>
<tr> <th>Name</th> <th>Salary</th>
</tr>
<tr> <td>Ramesh Raman</td>
<td>5000</td> </tr>
<tr> <td>Shabbir Hussein</td>
<td>7000</td> </tr>
</table>
</body>
Exercise: Write code for below output
Tables Backgrounds Using bgcolor and background
attribute
</table>
</BODY>
Table height and
width Attribute
Output:-
HTML <table>
align Attribute