HTML background | SoloLearn: Learn to code for FREE!


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.

3/24/2019 12:38:20 PM

Stefan Secrieru

5 Answers

New Answer


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.


Yes I have seen this on stack overflow but haven't posted because you mentioned to have background color for a div.


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


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!


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!