HTML code to create a table with six rows and three columns.

Q14. Write the HTML code to create a table with six rows and three columns. In the table, two header rows have the pink color, two table body rows have the orange color, and the last two footer rows have the red color. Insert some data in the table.

Ans.

<HTML>

<HEAD>

<TITLE>

</TITLE>

</HEAD>

<BODY>

<TABLE BORDER=”4”>

<THEAD BGCOLOR=”pink”>

<TR>

<TD> RollNo </TD>

<TD> Name </TD>

<TD> Grade </TD>

</TR>

<TR>

<TD> 111 </TD>

<TD>Amita Arora </TD>

<TD> 150 </TD>

</TR>

</THEAD>

<TBODY BGCOLOR= “orange”>

<TR>

<TD> 112 </TD>

<TD> Kartik Bhat </TD>

<TD> 165 </TD>

</TR>

<TR>

<TD> 113 </TD>

<TD> Sidharth Sharma </TD>

<TD> 160 </TD>

</TR>

</TBODY>

<TFOOT BGCOLOR=”red”>

<TR>

<TD> 114 </TD>

<TD> Kamal Sachdeva </TD>

<TD> 175 </TD>

</TR>

<TR>

<TD> 115 </TD>

<TD> Sonal Kapur </TD>

<TD> 170 </TD>

</TR>

<TFOOT>

</TABLE>

</BODY>

</HTML>

 

The output of the above mentioned code is shown in Figure 1:

 

Figure 1: Creating a Table as per the Given Specifications

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: