Computer Applications

Shagun wants to set different background colours for the individual cells of the table. How can she achieve this?

HTML Advanced Features

15 Likes

Answer

We can use the 'bgcolor' attribute of the <TD> element to give different colours to the cells of a table. Consider the following example,

<TABLE>
<TR> 
<TD BGCOLOR = "YELLOW"> Cell 1 </TD> 
<TD BGCOLOR = "PINK"> Cell 2 </TD> 
</TR>
<TR> 
<TD BGCOLOR = "BLUE"> Cell 3 </TD> 
<TD BGCOLOR = "GREEN"> Cell 4 </TD> 
</TR>
</TABLE>

Answered By

13 Likes


Related Questions