That simple.
Moving my layout into a fluid territory, working on scalable images. Using the img tag and setting max-width to 100% works perfectly, but i’d rather use a div with the image set as its background.
The issue I’m running into is that the image doesn’t scale to the size of the div it’s in the background of. Any way to add markup to the background code to set it to 100% width of it’s container?
#one {
background: url('../img/blahblah.jpg') no-repeat;
max-width: 100%;
}
You can do this with
background-size:There are a lot of values other than
coverthat you can setbackground-sizeto, see which one works for you: https://developer.mozilla.org/en-US/docs/Web/CSS/background-sizeSpec: https://www.w3.org/TR/css-backgrounds-3/#the-background-size
It works in all modern browsers: http://caniuse.com/#feat=background-img-opts