I need some kind of an elegant solution for background-image width 100% height auto. It must be the same way as it behaves like as if you use image src. I will use the example of another question on stackoverflow as the answers there did not work for me, nor did they work correctly at all.
Note: I will be putting this in css grids which will have an auto width and the image itself will have a border.
If there is a js solution, as long as it works, i don't mind.
#image {
background-image: url(http://www.w3schools.com/css/trolltunga.jpg);
background-size: 100% auto;
background-position: center top;
background-repeat: no-repeat;
width: 100%;
height: auto;
}
<div id="image">some content here</div>