The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Background Image stretching in HTML
I have this website http://goo.gl/6QZNxZ
The background image I have inserted this way–
<div> <img />/images/home-background.jpg" alt="bg" /> </div>
So I probably cant use media queries for this.. What can be best solution to this to avoid this image stretching issue
Why not actually use a background-image rather than an inline one/
background-image
I have added this to a div class..
.home-bg img{ background-size: cover; max-width: 100%; height:100%; }
The image shouldn’t be in a div, in fact, it shouldn’t be in the HTML at all. It should be in the CSS using the background-image property.
https://css-tricks.com/perfect-full-page-background-image/