Skip to content
WJunction - Webmaster Forum

Tutorials & Guides HTML Color - bgcolor Guide

Status
Not open for further replies.

Bharat

Senior Member
2,003
2010
841
The bgcolor attribute is used to control the background of an HTML elmement, specifically page and table backgrounds. Bgcolor can be placed within several of the HTML tags. However, we suggest you only use it for your page's main background (<body>) and in tables. For additional background styling. The HTML to change the background color is simple:

Syntax

<TAGNAME bgcolor="value"> Quick and dirty, here is how to change the background of your web page. Just use the bgcolor attribute in the <body> tag and you are golden.

HTML Code:

<body bgcolor="Silver"> <p>We set the background...</p> </body>


Paragraph Bgcolor:


90b42962ff.png


Adding Color to Your Tables


This example shows how to add a background color for an entire table using generic values of color.

HTML Code:

<table bgcolor="lime" border="1"><tr> <td>A lime colored table background using color names.</td> </tr></table> <table bgcolor="#ff0000" border="1"><tr> <td>A red colored table background using hexadecimal values "#FF0000".</td> </tr></table> <table bgcolor="rgb(0, 0, 255)" border="1"><tr> <td>A blue colored table background using RGB values "rgb(0, 0, 255)".</td> </tr></table>


Table Bgcolors:


6aef7b98c5.png


Adding Color to Table Rows & Columns

Here's a few common examples of "bgcolor" and font color

HTML Code:


<table> <tr bgcolor="#FFFF00"><td>This Row is Yellow!</td></tr> <tr bgcolor="#AAAAAA"><td>This Row is Gray!</td></tr> <tr bgcolor="#FFFF00"><td>This Row is Yellow!</td></tr> <tr bgcolor="#AAAAAA"><td>This Row is Gray!</td></tr> <tr bgcolor="#FFFF00"><td>This Row is Yellow!</td></tr> <tr bgcolor="#AAAAAA"><td>This Row is Gray!</td></tr> </table>


Alternating Colors:


kcYcT.png


Background Color and Font Color Together!


Check out this "Scoreboard" we made with the use of font color and bgcolor!

HTML Code:

<table bgcolor="#000000"> <tr><td bgcolor="#009900"> <font color="#FFFF00" align="right">Green Bay</font></td> <td><font color="#FFFFFF">13</font></td></tr> <tr><td bgcolor="#0000FF"> <font color="#DDDDDD" align="right">New England</font></td> <td><font color="#FFFFFF">27</font></td></tr> </table>
Scoreboard:

ece82ca74f.png


HTML Code:


<table bgcolor="#777777"> <tr><td> <p><font face="Monotype Corsiva, Verdana" size="4" color="#00FF00"> This paragraph tag has... </font></p> </td></tr> </table>


Colored Paragraph:


[FONT=Monotype Corsiva, Verdana]
8e407f23f8.png



Regards

Source
[/FONT]
 

6 comments

Status
Not open for further replies.

About the author

Bharat
Senior Member · Joined
2,003
Messages
841
Reactions
113
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom