0

I'm trying to fill a parent <div> with an image, while completely ignoring proportions. I know that it will look ugly at certain dimensions, I just want to see if it's possible at this point. As you can see, the image is scaling, rather than stretching to my demands (Chrome): http://jsfiddle.net/qdzaw/61/

Unfortunately, all I can find online is how to do this while maintaining proportions :/

<img class="someimage" src="imgsrc" />

$(window).resize(function() {
    $(".someimage").height($(".someimage").parent().height());     
    $(".someimage").width($(".someimage").parent().width());  
});
hohner
  • 11,498
  • 8
  • 49
  • 84
Paul Zaczkowski
  • 2,848
  • 1
  • 25
  • 26

2 Answers2

0

i think i find your answer in this post: Stretch and scale a CSS image in the background - with CSS only

use a parent div element and this stylesheet:

div {
    width: 100%; 
    height: 100%; 
}

img {
    width:100%;
    height:100%;
}
Community
  • 1
  • 1
0
div {
   position:relative;
}
div img {
   position:absolute; 
   top:0; left:0; right:0; bottom:0;
}
Kornel
  • 97,764
  • 37
  • 219
  • 309