+ 1

HTML background

Hell SoloLearn. I want to participate in a competition called OTI(in Romania). For this i must learn Microsoft Office(Excel,PowerPoint,Word,Access) and HTML. The websites that i must create are required to be made only in HTML and no CSS. One of the question asks me to create a section(a div I think) that has a background color. How can i change the background color of a div in HTML. It may be simple but I just can't figure it out. Thank you and have a great day.

24th Mar 2019, 12:38 PM
Stefan Secrieru
Stefan Secrieru - avatar
5 Answers
+ 9
There is no way you can set background without CSS // But if this competition is a tricky one, then you can use a image of a plane colour, and can set its width and height equal to the viewport without using CSS.
24th Mar 2019, 12:41 PM
Letsintegreat
Letsintegreat - avatar
+ 5
Yes I have seen this on stack overflow but haven't posted because you mentioned to have background color for a div. https://stackoverflow.com/questions/20609992/how-to-change-the-background-color-of-a-span-div-without-css
25th Mar 2019, 12:57 PM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 4
You can use inline CSS by style attribute to set background color in html however it is also considered as CSS styling or you can use bgcolor attribute to body. As Zlytherin said there is no way set background color these are the only way to full fill your requirements https://code.sololearn.com/WlC9mzed1Q8i/?ref=app
25th Mar 2019, 4:14 AM
Gurpreet Jhamat
Gurpreet Jhamat - avatar
+ 3
Zlytherin, Gurpreet J, thank you for your help. I might have missunderstood the question, because as you both said you can not do what I asked, but I will go over the question again and see if that is what it was really asking. Thank you for your time! Have a great day!
25th Mar 2019, 5:25 AM
Stefan Secrieru
Stefan Secrieru - avatar
+ 3
As Zlytherin said, it is a tricky competition. After talking to my teacher we found out that it is possible: if I make a table with one row and one column then I can set its bgcolor. The best way to do this is obviously with CSS, but I think it was a nice exercise. Thank you all for your help!
25th Mar 2019, 12:51 PM
Stefan Secrieru
Stefan Secrieru - avatar