Unit 1. HTML 7
Unit 1. HTML 7
<table frame=“box”>
Attributes of Table tag
<table rules=“box”>
<TR> and <TH>tags
▶ <TR> stands for Table Row
It is used to create a row of data in a table
It is used within the <table > tag
It is a container tag
▶ <TH> stands for Table Header
It is used to specify a table’s header
It displays the content of a table in heading style and content appears
in bold
It is a container tag
▶ Table Header, Body and Footer: It divides table into 3 sections
Header and footer will remain common for all pages
Body is the main content of the table
The three elements are <THEAD> <TBODY><TFOOT>
HTML Code to create a table using thead,
tbody and tfoot
<HTML>
<Head><title>table</title></head><body>
<table border=“2”>
<thead bgcolor=“green”>
<tr>
<td>Stud_name</td>
<td>roll_no</td>
<td>Percentage</td></tr></thead>
<tbody bgcolor=“blue”>
<tr><td>Amita</td><td>18</td><td>81</td></tr>
<tr><td>Anupriya</td><td>20</td><td>89</td></tr><
/tbody>
<tfoot bgcolor=“brown”>
<tr><td>Sanjay</td><td>21</td><td>79</td></tr>
</tfoot></table></body></html>
<TD>tag and its attributes
▶ The <td> tag (table data) is used to specify a cell or table data in
a table
▶ It is a container tag
▶ It is contained within <TR> tag
▶ Attributes of <TD> tag :
align attribute : To align table data(left,right,center)
<td align=“right”>
width :To define the width of the cells in table
<td width=50>
height : To specify the height of the cell in table
<td height=50>
bgcolor : It specifies a background color for the entire table
<td bgcolor=“red”>
▶ Attributes of <TD> tag :
rowspan & colspan : Helps to combine row cells and column
cells
<td colspan="2">….</td>
<td rowspan="2">….</td>
valign : Determines the placement of the content in the
cell (Top,Middle,Bottom)
<td valign="Top"< ">….</td>
Assignment
Write an HTML code to generate the given table in web page exactly as given.