Posts Tagged ‘html background’

Html Background Colors


The bgcolor attribute is used to control the background of an HTML elmement, specifically page body and table backgrounds. Following is the syntax to use bgcolor attribute with any HTML tag.

Following is the syntax to use bgcolor attribute with any HTML tag.

<tagname bgcolor="color_value"…>

This color_value can be given in any of the form.

<!– Give color name –>
<table bgcolor="lime" >

<!– Give hex value –>
<table bgcolor="#f1f1f1" >

<!– Give color value in RGB terms –>
<table bgcolor="rgb(0,0,120)" >

 

Example:

Here are the examples to set background color of an HTML tag.

<!– Give color name –>
<table bgcolor="yellow" width="100%" >
<tr><td>
This background is yellow
</td></tr>
</table>

<!– Give hex value –>
<table bgcolor="#6666FF" width="100%" >
<tr><td>
This background is sky blue
</td></tr>
</table>

<!– Give color value in RGB terms –>
<table bgcolor="rgb(0,0,255)"  width="100%" >
<tr><td>
This background is blue
</td></tr>
</table>

This will produce following result:

This background is yellow

This background is sky blue

This background is blue

To Become more comfortable – Do Online Practice

Designed for Mytoptutorials.com