can i add bgcolor atribute to div tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can i add bgcolor atribute to div tag?

5th Nov 2017, 10:54 AM
Jitendra Sahoo
2 Answers
+ 4
'bgcolor' is deprecated attribute in Html5... You should use 'background-color' (or it's shorthand writting 'background') css property to set a background color to any element ^^ Inlined styling of your div should be something as: <div style="background:red;">...</div> Obviously, externalized css rules are better practice ;P
5th Nov 2017, 11:23 AM
visph
visph - avatar
+ 4
yes,you can add background-color attribute syntax:- <body> <div style="background-color:red;"> </div> </body>
5th Nov 2017, 11:23 AM
Elizabeth🌸
Elizabeth🌸 - avatar