responsive image with a div as background
I have a div that i want to give an image background. i can then place another div inside this for some text. i have looked over the internet but cant find what i need. i know how to make an image responsive with a div
Code:
<div class="main-image"><img src="images/panels/57-2.jpg" style="width:100%; height:auto;"></div>
but not as a background
this is what i have so far but because there is not an actual image in the div i know it wont show up
Code:
.main-image {
background-image: url(../images/panels/57-2.jpg);
background-repeat: no-repeat;
width: 100%;
height: auto;
}
and the div
HTML Code:
<div class="main-image"></div>