how do you change the background colour in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how do you change the background colour in HTML?

how do you change the background colour in HTML? If the <style> tag is reqired, pls help with that too.

29th Jul 2019, 6:37 AM
Stealthycoder2007
Stealthycoder2007 - avatar
7 Answers
+ 3
<style> body{ background-color: __color here__; } </style>
29th Jul 2019, 7:31 AM
Frenchtoast
Frenchtoast - avatar
+ 8
Just Remember one thing if you are setting background color with html use "bgcolor" and if you are setting it with css use " background-color " property.
30th Jul 2019, 12:48 PM
Ayushi Gujarati
Ayushi Gujarati - avatar
+ 4
With a little help from CSS.
29th Jul 2019, 7:59 AM
Sonic
Sonic - avatar
+ 2
The font tag is hopelessly outdated, it is better to use a class (or id) and css
31st Jul 2019, 12:09 PM
VasiliySemenov
VasiliySemenov - avatar
+ 2
Place below code in ur webpage head section <style> body { background-color : _colorName ; } </style>
2nd Aug 2019, 6:04 PM
GK();
GK(); - avatar
+ 1
<body bgcolor=ā€œblackā€> <font color=ā€œredā€> Hello! </font> </body> This will give you black background with ā€˜Hello!ā€™ in red.
29th Jul 2019, 6:01 PM
7Pineapple
7Pineapple - avatar
0
Es mejor usar CSS externo en otro archivo y vincularlo a tu archivo html ejemplo: <link rel="stylesheet" type="text/css" href="archivo.css" /> Y adentro del archivo CSS escribes: body { background-color: color*; }
29th Jul 2019, 2:41 PM
Samuel Alejandro Gonzalez
Samuel Alejandro Gonzalez - avatar