+ 4

why bgcolor attribute not work with div tag in html

I created a table in HTML. In code I write <div bgcolor="blue"> .... </div> But this code not run Why please give me reply

9th May 2019, 4:41 PM
jay goti
jay goti - avatar
5 Antworten
+ 3
BaselAl hajeri is style attribute from css??
10th May 2019, 7:28 AM
jay goti
jay goti - avatar
+ 2
bgcolor attribute doesn't work with every elements Try with css <div style="width: 100px; height: auto; background-color: blue;"></div>
9th May 2019, 5:23 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 2
Because {Background-color}(correct) Bgcolor (wrong)
14th May 2019, 4:13 PM
Abduo Saber
Abduo Saber - avatar
+ 1
Use pure CSS for better result. Because all elements doesn't support bgcolor
11th May 2019, 6:27 AM
Imdad Hussain Mamud
Imdad Hussain Mamud - avatar
+ 1
Since, bgcolor attribute get deprecated by css. So, you must either use bgcolor attribute in table tag rather than div tag or define background-color attribute to the div tag.
11th May 2019, 6:42 AM
Garima Agrawal