I am using responsive bootstrap design.
I want to arrange images in rows and columns. But images are overlapping on each other and not sure why.
Here is my code
<div class="container">
<div class="item" style="width: 194px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item" style="width: 194px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item" style="width: 194px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
</div>
Here is link to Fiddle
You need to limit the size of your images with max-width so they will scale with the size of the parent element.
img {max-width:100%;}
I've updated your fiddle: https://jsfiddle.net/pk1pr96n/38/
Why do you not use css?
.item {
float:left;
}
.container {
width:1050px;
}
https://jsfiddle.net/pk1pr96n/37/
you mean this?
ps. needed to increase the container div because of images size.
Your images are 350px wide, but you define the width style as 194px.
You need this.
<div class="container">
<div class="item" style="width: 350px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item" style="width: 350px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item" style="width: 350px;height:422px;float:left">
<img src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
Having said that, this won't actually be responsive because you're defining the image size and not allowing it to be responsive. If you want responsive images, try something like this:
<img src="..." class="img-responsive" alt="Responsive image">
UPDATE with example:
Depending on how you want the images to lay out on mobile devices, you can put each in its own column (eg. .xs-col-4) like this:
<div class="container">
<div class="row">
<div class="item col-xs-4 col-sm-4 col-md-4 col-lg-4" style=";float:left">
<img class="img-responsive" src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item col-xs-4 col-sm-4 col-md-4 col-lg-4" style="float:left">
<img class="img-responsive" src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
<div class="item col-xs-4 col-sm-4 col-md-4 col-lg-4" style="float:left">
<img class="img-responsive" src="http://www.imagesfestival.com/images/resize.php?width=350&src=images/news/216.jpg" />
</div>
</div>
</div>
This will make it so the three images are always side by side regardless of screen size. If you want them to stack on smaller devices, then you can adjust the col-xs-4 etc until you get the result you need.
Related
the picture of the website on mobile, and the problem
<div class="row">
<div class="col-md-7 col-xs-12">
<div>
<img class="img-responsive" src="https://www.thedrisco.co.il/octopus/Upload/images/Pages/restor-his%201.jpg" /></div>
<div style="display: inline-flex; padding-top: 45px;">
<img src="https://www.thedrisco.co.il/octopus/Upload/images/Pages/classic2%201%20(6).jpg" style="height: 240px;" /></div>
<div style="padding-right: 67px;">
<img src="https://www.thedrisco.co.il/octopus/Upload/images/Pages/classic2%201%20(5).jpg" style="height: 240px;" /></div>
</div>
</div>
</div>
I have this piece of code.. now, I need the images that are in inline flex to fit in a column instead of next to eachother on mobile, and the images to stretch to the size of the device of course. Any Ideas? I added an image for reference to what I'm talking about. Thanks in Advance!
When working with Bootstrap, it’s easiest to define each row separately, and then divide up each row into different columns based on the device, so you could have your restorer image on its own row and the two classic images in the same row.
<div class="container">
<div class="row justify-content-end mb-3">
<div class="col-12 col-md-9">
<img class="float-right w-100"
src="restor-his%201.jpg" />
</div>
</div>
<div class="row justify-content-end">
<div class="col-12 col-md-7 mb-3 mb-md-0">
<img class="float-right w-100" src="classic2%201%20(6).jpg" />
</div>
<div class="col-12 col-md-5 order-md-first">
<img class="float-right w-100" src="classic2%201%20(5).jpg" />
</div>
</div>
</div>
To get the ratio right between the two classic images, I did reduce the width from 430 to 419px, rather than setting the height to a fixed value.
I'm just starting to use bootstrap to code a website, but I'm running into issues with some of the images that I put on a particular webpage. I want all four of the images to be the same size, but some of them aren't. Can a change in image resolution change how it is displayed on the webpage??
<div class="row row-offcanvas row-offcanvas-right">
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<a href="google.com">
<img src="/images/book-photo.jpg"" width="300" height="200" class="img-responsive img-rounded">
<h4>Books</h4>
</a>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="/images/sports-photo2.jpg" width="300" height="200" class="img-responsive img-rounded">
<h4>Sports</h4>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="/images/concerts-photo.jpg" width="300" height="200" class="img-responsive img-rounded">
<h4>Concerts</h4>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="/images/sublease-photo.jpg" width="200" height="200" class="img-responsive img-rounded">
<h4>Subleases</h4>
<span class="text-danger">Coming Soon</span>
</div>
</div>
Example of different image sizes:
If you want them to take up the same amount of space, set those as the background of the divs instead. Background-size:cover will make it take up the whole height/width of the div without stretching the photo. It will just cut off the sides a little to make it stay the same proportion. Background-position:center center will make the photo centered vertically and horizontally in the divs. You would just need to place a set height on the divs for the background to show.
This is driving me nuts and it seems like the solution is a simple one I am overlooking. I have a row of three images and it is my understanding that bootstrap takes care of the alignment of content.
Shouldn't the third image be aligned to the right side of the container with all three being equally spaced?
http://codepen.io/amits/pen/oxbjmd?editors=1100
<div class="row">
<div class="col-md-4">
<img src="">
</div>
<div class="col-md-4">
<img src="">
</div>
<div class="col-md-4">
<img src="">
</div>
</div>
what am I missing?
you are missing the .container, and .img-responsive in img tag, plus you can have .col-sm-* for small devices and .col-xs-* for extra small devices.
added .col-xs-4 just for demo
take a look at the Docs
.container {
border: red solid
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-xs-4 col-md-4">
<img class="img-responsive" src="//lorempixel.com/1200/900">
</div>
<div class="col-xs-4 col-md-4">
<img class="img-responsive" src="//lorempixel.com/1200/900">
</div>
<div class="col-xs-4 col-md-4">
<img class="img-responsive" src="//lorempixel.com/1200/900">
</div>
</div>
</div>
I'm trying to create a responsive row that, when displayed on an iPad, the 3 images go across the screen like on desktop. Currently they are behaving like they are on mobile and expanding vertically, not horizontally.
The images are the 3 product range images on the website: http://dekatest.neto.com.au/
<div class="container" style="text-align:center;">
<div class="row"><img alt="" src="/assets/images/MEDICAL-RANGE.jpg" style="max-width:100%;" /><img alt="" src="/assets/images/SPROTS-RANGE.jpg" style="max-width:100%;" /><img alt="" src="/assets/images/WELLBEING-RANGE.jpg" style="max-width:100%;" /></div>
</div>
If you are using Bootstrap try something like this
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<img alt="" src="/assets/images/MEDICAL-RANGE.jpg" />
</div>
<div class="col-sm-4">
<img alt="" src="/assets/images/SPROTS-RANGE.jpg" />
</div>
<div class="col-sm-4">
<img alt="" src="/assets/images/WELLBEING-RANGE.jpg" />
</div>
</div>
</div
and with CSS add the properties and styles to your tags
img { max-width: 100%; }
Note: you should change the value of col-sm-* depending on what you are trying to do.
if you are only using row just because of that you don't need padding between images. So simple is that make separate class for controlling padding of col-sm. You should have to use col-* inside row then it will be work fine.
CSS
.no-p{
padding-left:0px;
paddding-right:0px;
}
HTML
<div class="container text-center">
<div class="row">
<div class="col-xs-4 no-p">
<img class="img-responsive" alt="" src="https://placeholdit.imgix.net/~text?txtsize=47&txt=500%C3%97500&w=500&h=500" />
</div>
<div class="col-xs-4 no-p">
<img class="img-responsive" alt="" src="https://placeholdit.imgix.net/~text?txtsize=47&txt=500%C3%97500&w=500&h=500" />
</div>
<div class="col-xs-4 no-p">
<img class="img-responsive" alt="" src="https://placeholdit.imgix.net/~text?txtsize=47&txt=500%C3%97500&w=500&h=500" />
</div>
</div>
</div>
View on JsFiddle: https://jsfiddle.net/L2y3ybff/
OK, so first off I'm a designer that's been pushed into development. Have had to learn most of what I know within the last week. So apologies for my lack of knowledge.
I'm sure I've done things the wrong way but as you can see from the images I've tried creating a grid of images that will soon be clickable through to different parts of the site. Only issue is when the browser is scaled down to a tablet size things go wrong.
If anyone can help I'd appreciate it!
http://i.imgur.com/1cvq0d0.png
http://i.imgur.com/5nS6wdz.png
HTML
<div class="row">
<div class="col-md-6">
<div class="row-fluid">
<div class="col-sm-4 col-xs-4 box"><img src="images/b1.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
<div class="col-sm-4 col-xs-4 box"><img src="images/b2.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
<div class="col-sm-4 col-xs-4 box"><img src="images/b3.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
</div>
<div class="row-fluid">
<div class="col-sm-4 col-xs-4 box"><img src="images/b4.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
<div class="col-sm-4 col-xs-4 box"><img src="images/b5.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
<div class="col-sm-4 col-xs-4 box"><img src="images/b6.jpg" alt="test" class="img-responsive" />
<div class="carousel-caption-rob">
<h5>Malmaison Hotel</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is all the box class you can see is
.box{
padding: 0px;
}
Keep up trying to learn this stuff! So I did not really understand why you have the content wrapped in a "col-md-6". Other then that, the "col-sm-4" in addition to the "col-xs-4" in somewhat redundant. Bootstrap is designed to be mobile first, so calling just "col-xs-4" is like calling "col-lg-4 col-md-4 col-sm-4 col-xs-4". Another note is "row-fluid" does not exist in Bootstrap 3.
If I were to build what you are trying to make today it would look like this:
https://gist.github.com/WilliHyde/dea9bd0e193f542a648e
Please note I just did the basic framework and did not do any of the styles for font color and such.
Good luck and keep it up! Remember, the Bootstrap docs are the key!