HTML-The bgcolor Attribute
HTML – The bgcolor Attribute
The bgcolor characteristic is utilized in order to determine the background color of an HTML element. Bgcolor is one of those characteristics that have become belittled by the execution of Cascading Style Sheets . The reason we’ve maintained it in this tutorial is due to the fact that it will provide us with an occasion to introduce web colors and supplementing some life to our HTML web page as we continue to move forward through this tutorial. It will be utilized as a visual help for you as you are grasping the mechanics of creating a table.
Without much effort, we can bring that boring white web page to life by suplementing some color with the bgcolor characteristic.
HTML Bgcolor Code:
1 2 3 |
<body bgcolor="red"> <p>This page now has a RED background!</p> </body> |
Html – web colors
Our example utilizes the text value, which is one of three various kinds of color values that can be utilized with the bgcolor characteristic. Tables of the 16 key HTML color values that are presented to HTML web designers are offered below.
HTML Basic Colors:
Black | Gray | Silver | White | ||||
Yellow | Lime | Aqua | Fuchsia | ||||
Red | Green | Blue | Purple | ||||
Maroon | Olive | Navy | Teal |
While the table above shows only 16 colors, 16 is of course not restrict to our color wheel. As we pointed out, HTML supports three various kinds of color values involving text values (which we’ve pretty much covered above), numeric, (RGB) and hexadecimal values. We’ll go into more detail regarding these values so just sit tight. This next example presents a creep peak at what these values may seem.
HTML Code:
1 2 3 4 5 6 7 8 9 10 11 |
<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 numeric, RGB values "rgb(0, 0, 255)".</td> </tr></table> <table bgcolor="lime" border="1"><tr> <td>A lime colored table background using color names.</td> </tr></table> |
HTML developers are allowed to broaden the color wheel beyond 16 colors via Hexadecimal and numeric color values (RGB). Way beyond 16, in fact however it’s not necessary to memorize 256+ unique color combinations; instead, we can use numeric and hexadecimal values and calculate color shades. We’ll show teach how to utilize them in our HTML Color Codes page.
Html – coloring fonts, table rows, & table columns
Some usual examples of bgcolor in action are presented.
HTML Bgcolor Code:
1 2 3 4 5 6 7 8 |
<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> |
Investigate this “Scoreboard” we create with the use of font color and bgcolor!
HTML Code:
1 2 3 4 5 6 7 8 9 |
<table bgcolor="#000000"> <tr><td bgcolor="#009900" align="right"> <font color="#FFFF00">Green Bay</font></td> <td><font color="#FFFFFF">13</font></td></tr> <tr><td bgcolor="#0000FF" align="right"> <font color="#DDDDDD" >New England</font></td> <td><font color="#FFFFFF">27</font></td> </tr> </table> |
tips
- If you are novice with regard to HTML, consider sticking with color names in order to determining your background color.
- 256 “true colors” are exists along with hexadecimal values. Hex-pairs for red, green, and blue create the colors. Examples: #99FFCC, #33AA44.
- When the 3 paired amounts of each color are identical shades of gray take place. Example. “rgb(100,100,100)”, “#333333,” “#0A0A0A”
- Evade light, headache-causing color plans! Keep your coloring vivid and decisive.
- Check out our HTML Color Codes lesson for more information about colors.