0

I have 3 images stacked horizontally (each image is next ot the other). my goal is to keep those images stacked horizontally when i scale down the page size. i would like the pictures to automatically resize down without breaking it to the next line. i don't want to use percents (%) for the size of the images. I don't want to set the size of the images at all.

When I am using bootstrap and I scale down the page, when the page size become smaller then the pictures size, then the image on the right breaks to new line, the same thing happens for the second image, until all the images stacked vertically. on this point, when I scale down the page even more I get exactly what I wanted - the pictures are resizing according to the page size.

please help me to get this behavior without breaking the pictures to new lines.

this is my html:

 <body>
     <img src="img/test.png" />
     <img src="img/test.png" />
     <img src="img/test.png" />
</body>

Thanks...

2 Answers2

0
@media (min-width:450px;){
   img{
       width:50%;/*or whatever floats your boat*/
   }
}

You can modify the min-width: value to customize your needs. This won't handle resizing. Just different media sizes.

You can use jQuery.resize to handle actually resizing a browser window like so:

$(window).resize(function(){

    var div = $('#images');//images container
    div.find('img').each(function(k,v){

        $(v).width((div.width()/4));//resize each image however you want
    });
});
bluetoft
  • 5,373
  • 2
  • 23
  • 26
0

Wrap your images in whatever container, say a div, then you have two options depending on the behaviour you want:

a) Set a css min-width property for the container and don't let it go narrower than that. b) Set a css overflow-x property for the container and let the images either hide, show a scroll bar, ...

palako
  • 3,342
  • 2
  • 23
  • 33