+ 10

How can I make background color by using <div> </div> ??? 😕😕

How can I make background color by using <div> </div> attribute ? I hope someone ask this question ...

3rd Mar 2018, 3:03 PM
Hani
Hani - avatar
9 Answers
+ 9
with css you can make. ----------------------------------------- div { width:100px; height:50px; background-color:blue; } ----------------------------------------- that's it...
3rd Mar 2018, 3:12 PM
Kunal Kumar
Kunal Kumar - avatar
+ 23
Use css div{ background-color:red; } or use inline style <div style="background-color:red;"></div>
3rd Mar 2018, 3:05 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 20
Don't use bgcolor. It's old HTML4 which is not used now and is deprecated.
4th Mar 2018, 4:42 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 12
Use css div{ background-color:red; } or use inline style <div style="background-color:red;"></div>
22nd May 2018, 9:51 AM
Hani
Hani - avatar
+ 3
It's better having that div with a class so not all divs are colored. You may use: <div class="red_background">Hi!</div> and then a css style to use it elsewhere: .red_background{ background-color:#f00; //or red }
4th Mar 2018, 8:13 AM
David Bravo
David Bravo - avatar
+ 2
<div bgcolor="blue(or a color of your choice)" > </div>
3rd Mar 2018, 9:25 PM
Vinko Ramljak
Vinko Ramljak - avatar
+ 2
ok
4th Mar 2018, 7:42 AM
Sonali Debnath
Sonali Debnath - avatar
+ 2
with css <style> .me{ background-color:tomato; } </style> </head> <body> <div class="me"> </div> </body>
2nd Aug 2018, 11:26 AM
Hivindu Amaradeva
Hivindu Amaradeva - avatar
+ 1
bgcolor ="red"
5th Mar 2018, 9:43 AM
P. Yuva Krishna
P. Yuva Krishna - avatar