How to resize background image?
I followed a tutorial about resizing background images on this link
How To: Resizeable Background Image
I was trying to edit it to work on div with width of 900px so it will resize only vertically开发者_JAVA百科 and I have no idea how to make it work.
Any one can tell me how to do it as I want.
Thanks
Are you using the first, second or third approach?
Considering the third approach, it might simply work if you change width to height:
#img.source-image {
height: 100%;
position: absolute;
top: 0;
left: 0;
}
In case this doesn't work, have a look at this question and this other question and experiment with your body height and DOCTYPE
. You might also want to ask the same question on doctype.com.
Seems like this:
#yourDiv{
background-size:cover}
But the compatibility is limited. Example here.
精彩评论