background color | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

background color

I am new to learning coding and need some help when i used this: <!DOCTYPE html> <html> <head> <title>first page</title> </head> <body> <table border=”2”> <tr> <td bgcolor=”red”>red</td> <td>blue</td> <td>green</td> </tr> </table> </body> </html> the background color is green, not red.

18th Jan 2017, 3:13 PM
Melissa Harris
Melissa Harris - avatar
3 Answers
+ 4
So... dont USE ” You should use normal, programming quotes. Like these: " Also customization is not supported in html5 anymore Fixed version of code xD <!DOCTYPE html> <html> <head> <title>first page</title> </head> <body> <table border="2"> <tr> <td bgcolor="red">red</td> <td>blue</td> <td>green</td> </tr> </table> </body>
18th Jan 2017, 3:23 PM
WittyBit
WittyBit - avatar
0
try <td bgcolor="#FF0000" >red</td>
18th Jan 2017, 4:03 PM
Carlo Gagliolo
Carlo Gagliolo - avatar
- 1
yes.. go with either bgcolor="#ff0000" or bgcolor="#f00" both are the same. It is called hexadecimal color code and you can make any color with it. It is basically mixing the 3 color channels and 'f' fully opens that channel while '0' entirely closes the color channel. The channels are Red, Green and Blue (RGB). As you can see in the hexadecimal for red ff0000 ... ff (red) 00 (green) 00 (blue) the Red channel is open (ff) and the Green and Blue are closed (00). so Green would be "#00ff00" or "#0f0" and Blue would be "#0000ff" or "#00f" Every channel has 2 values between 0 to 9 and a to f. Try and play some with it.... it is awesome!
18th Jan 2017, 6:42 PM
John van den Elzen
John van den Elzen - avatar