+ 1
What is wrong with the code given in description?
link:https://code.sololearn.com/WX0ygRbrFRX7/#html So i was trying to add background image to my html file using css.When i add image using tag(div) it is visible but when i use attributes like class and id the image is not visible.Please elaborate.
2 Respuestas
+ 3
You have to set width and height of the div.
https://code.sololearn.com/W14P9HVdbsgS/?ref=app
0
When you were trying to add background-image by "div", there was element in the div tag. So the background-image was displayed!
But when you were adding background-image by "bgi" class, there was no element in that class. So the image wasn't displayed but if you use bgt as class then the background-image will be displayed because there are elements in bgt class.