Usually we can't make <div> center align while working with odd columns. Here is my problem.
This is developed using Bootstrap. I want all inner divs to be in the center. So, when the page is viewed on other devices everything is center-aligned. When viewed at md screen width there is a little space on right side.
I want three columns at md and lg widths, two columns at sm widths, and one column at xs width. On all viewports, it should be center-aligned.
Here is my markup:
<div class="container-fluid">
<div class="row-fluid">
<div class="fleet_bor col-lg-4 col-md-4 col-sm-4 col-xs-12 col-centered">
<a href="http://someurl.com/gulfstream-iii/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/III-01-300x240.jpg" />
</a>
<h4>Gulfstream III</h4>
</div>
<div class="fleet_bor col-lg-4 col-md-4 col-sm-4 col-xs-12">
<a href="http://someurl.com/gulfstream-iv-sp-1/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/V2-1-300x240.jpg" />
</a>
<h4>Gulfstream V2</h4>
</div>
<div class="fleet_bor col-lg-4 col-md-4 col-sm-4 col-xs-12">
<a href="http://someurl.com/gulfstream-iv-sp-1/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/FLEET_SP1.jpg" />
</a>
<h4>Gulfstream SP1</h4>
</div>
<div>
</div>
I have found a best solution regarding this, i have this issue due to odd number of columns so i just added a span column on left and right side and the working columns in middle, that it solved my problem!, here is code what i did.
<div class="entry-content">
<div class="col-lg-1 col-md-1 col-sm-1 hidden-xs"></div>
<div class="col-lg-10 col-md-10 col-sm-11 col-xs-12 moile_fix_">
<div class="fleet_bor col-lg-4 col-md-4 col-sm-6 col-xs-12">
<a href="http://someurl.com/gulfstream-iii/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/III-01-300x240.jpg">
</a>
<h4>Gulfstream III</h4>
</div>
<div class="fleet_bor col-lg-4 col-lg-offset-0 col-md-4 col-md-offset-2 col-sm-4 col-sm-offset-0 col-xs-12 col-xs-offset-0">
<a href="http://someurl.com/gulfstream-iv-sp-1/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/V2-1-300x240.jpg">
</a>
<h4>Gulfstream V2</h4>
</div>
<div class="fleet_bor col-lg-4 col-md-4 col-sm-6 col-xs-12">
<a href="http://someurl.com/gulfstream-iv-sp-1/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/FLEET_SP1.jpg">
</a>
<h4>Gulfstream SP1</h4>
</div>
<div class="fleet_bor col-lg-4 col-lg-offset-0 col-md-4 col-md-offset-2 col-sm-4 col-sm-offset-0 col-xs-12 col-xs-offset-0">
<a href="http://someurl.com/gulfstream-g550/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/G5500-1-300x244.jpg">
</a>
<h4>Gulfstream G550</h4>
</div>
<div class="fleet_bor col-lg-4 col-md-4 col-sm-6 col-xs-12">
<a href="http://someurl.com/gulfstream-v1/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/V1-1-300x240.jpg">
</a>
<h4>Gulfstream V1</h4>
</div>
<div class="fleet_bor col-lg-4 col-lg-offset-0 col-md-4 col-md-offset-2 col-sm-4 col-sm-offset-0 col-xs-12 col-xs-offset-0">
<a href="http://someurl.com/gulfstream-iv-sp-2/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/FLEET_SP2.jpg">
</a>
<h4>Gulfstream SP2</h4>
</div>
<div class="fleet_bor col-lg-4 col-md-4 col-sm-6 col-xs-12">
<a href="http://someurl.com/gulfstream-iv-sp-3/">
<img class="img-responsive" src="http://someurl.com/wp-content/uploads/2014/11/FLEET-SP3.jpg">
</a>
<h4>Gulfstream SP3</h4>
</div>
</div>
<div class="col-lg-1 col-md-1 hidden-sm hidden-xs"></div>
</div>
Wrap in outer div and offset the col.
It is not perfect, but it works. You'll need to make the transition fluid as well, but it should help you get everything centered-ish
http://getbootstrap.com/css/#grid-offsetting
Related
I've been trying to create few images that should be displayed in a single row.
Currently it is displayed one-by-one.
Here's my code:
# CSS:
.emblems-section {
z-index: 1;
text-align: center;
}
<header>
<div class="container">
<div class="row">
<div class="col-md-12 emblems-section justify-content-center align-items-center">
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/leagueEmblem.png" class="img-fluid" alt="Statistics for League of Legends">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/overwatchEmblem.png" class="img-fluid" alt="Statistics for Overwatch">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/dotaEmblem.png" class="img-fluid" alt="Statistics for Dota2">
</div>
</div>
</div>
</div>
</header>
For anyone looking for the same solution, the answer is d-flex within the parent div.
<div class="container">
<div class="row">
<div class="col-md-12 emblems-section justify-content-center align-items-center">
<div class="row">
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/leagueEmblem.png" class="img-fluid" alt="Statistics for League of Legends">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/overwatchEmblem.png" class="img-fluid" alt="Statistics for Overwatch">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/dotaEmblem.png" class="img-fluid" alt="Statistics for Dota2">
</div>
</div>
</div>
</div>
</div>
//you have to add row after col-md-12
It is best practice that try to avoid unnecessary div or other elements in code structure. so you don't need to use col-md-12 just replace col-md-12 to row class and remove duplicate row div.
Use below code, by using this you can remove one unrequired div element, so your code looks compressed and beautiful.
<header>
<div class="container">
<div class="row emblems-section justify-content-center align-items-center">
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/leagueEmblem.png" class="img-fluid" alt="Statistics for League of Legends">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/overwatchEmblem.png" class="img-fluid" alt="Statistics for Overwatch">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/dotaEmblem.png" class="img-fluid" alt="Statistics for Dota2">
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-md-12 d-flex emblems-section justify-content-center align-items-center">
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/leagueEmblem.png" class="img-fluid" alt="Statistics for League of Legends">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/overwatchEmblem.png" class="img-fluid" alt="Statistics for Overwatch">
</div>
<div class="col-lg-4 col-md-4 col-xs-4">
<img src="img/dotaEmblem.png" class="img-fluid" alt="Statistics for Dota2">
</div>
</div>
</div>
</div>
you can add d-flex class with col-md-12
I need some advice how to display the logos to be 3 in a row on mobile and 5 in a row on a desktop. I added classes which are hidden on mobile and it works fine but it's broken on a desktop because the logos are not centered. I tried to divide 3 separate rows and it works but it's broken on mobile because I have 5 logos on row, so on mobile appears as 3-2 3-2 3-2. If anyone has an idea how to fix it, it will be great. Thanks!
`
<div class="row" style="filter: grayscale(100%); opacity: 0.6;">
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greywilson.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greytoyota.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyhaven.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyrakuten.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greymorrisons.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<br>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greylivingsocial.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greywiley.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greybca.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greysecretsales.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greytalk-talk.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<br>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyrya.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greylovefilm.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greybritish-heart-found.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greypots-and-co.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyone-water.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
</div>
`
I assume that you are using Bootstrap 3.3.7.
You have to replace the <br> Tag with the following tag: <div class="clearfix hidden-xs hidden-sm"> </div>
For more Details have a look at http://bootstrapdocs.com/v3.3.6/docs/css/#grid-responsive-resets
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="row" style="filter: grayscale(100%); opacity: 0.6;">
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greywilson.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greytoyota.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyhaven.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyrakuten.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greymorrisons.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="clearfix hidden-xs hidden-sm"> </div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greylivingsocial.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greywiley.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greybca.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greysecretsales.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greytalk-talk.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="clearfix hidden-xs hidden-sm"> </div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyrya.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greylovefilm.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greybritish-heart-found.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greypots-and-co.png">
</div>
<div class="col-md-2 col-sm-4 col-xs-4 centered">
<img class="img-responsive" src="http://www.image-maps.com/m/private/0/04en6oj9bira9hppfnsghibao6_logos-greyone-water.png">
</div>
<div class="col-md-1 hidden-xs hidden-sm">
</div>
</div>
I have the following code:
<div class="row second-row">
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
</div>
When we have a big screen, al the images show side by side on the same row, and when I go to a smaller screen they stack one on top of the other.
How can I make a break between each image? I need it to have a white space like each image was on a different row.
I tried adding <br> that were only visible with xs or sm but it didn't work. Is this possible in a simple way, or should I add paddings on a media query?
Try this and see if it works.
<div class="row second-row">
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-xs-1 visible-xs">
<br/>
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-xs-1 visible-xs">
<br/>
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
<div class="col-xs-1 visible-xs">
<br/>
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<img class="img-responsive" src="http://placehold.it/200x150">
</div>
</div>
#media only screen and (max-width : 768px) {
.col-class-here {
margin-top: 15px;
}
}
Why would there be a problem with doing this? Pretty much what you suggested yourself. This IS a simple way.
On my page I have lots of elements, which I need to show by several in a row in straight columns. Each element is an image of equal size. When you click on it, on it's place appears icon menu with three items in a row. All elements should be centred horizontally and vertically.
There could be a different number of big images (6, 7, 8 or more) so I want to add them in one row-class.
Now, I think I'm doing everything by bootstrap documentation, but elements logic on the page steel appears to be broken.
What am I doing wrong?
Codepen example
<body>
<div class="container-fluid wrapper">
<div class="row center-block text-center">
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row-fluid center-block text-center pagination-centered">
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
<div class="col-md-4 center-block text-center pagination-centered link">
<a target="_blank" href="#"><img src="http://img.leprosorium.com/2474848"></a>
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
<div class="center-block col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="row center-block">
<div class="col-md-12 center-block">
<img src="http://img.leprosorium.com/2474872">
</div>
</div>
</div>
</div>
</div>
</body>
Screenshot of what I get:
Screenshot of what I need:
Please point me in the right direction. Thank you in advance. I was able to done it without bootstrap, b I hope it could be done only by the right usage of bootstrap and elements, because I want to save the adaptive layout.
UPD #LegendaryAks fixed the problem with gap by using <div class="clearfix"></div> after icons element, but problem of centering all elements for the adaptive layout and unknown number of total elements is still open.
UPD2 Centering just one element in the end is not enough, because we need to know how to center from one to max number of elements on the last row, sow that we could load all the elements on a page with no worry for the last row centering.
There you go i think this did the trick . You can check the demo at http://codepen.io/anon/pen/QybXQJ?editors=100
What i did is I added a div with class clearfix after the fourth div. I hope this is what you are looking for
<div class="clearfix"></div>
there the solution using only css:
.center-block-big:nth-child(4n+1) {
clear: left;
}
.center-block-big:last-child {
margin: 0 auto;
float: none;
}
the only thing is that in this example i have removed the col-lg-2 to apply it to all resolution, and edited the class name to only apply to the container of the big images and not the twitter ones.
updated codepen
If you want mantain the space on lg resolution you need to play with the col width a bit in this way:
updated codepen
If you have dynamic elements you can use this to make that only if one element is on a row it will be centered:
.center-block-big:nth-child(4n+1) {
clear: left;
}
.center-block-big:last-child:not(:nth-child(5n)) {
margin: 0 auto;
float: none;
}
.center-block-big:nth-child(4n+2),
.center-block-big:nth-child(4n+3),
.center-block-big:nth-child(4n) {
float: left!important;
}
updated codepen, add .center-block-big elements to see the effect
use col-md-12 instead of col-md-6 at the last element of your design.
Try this:
<div class="col-md-12 center-block text-center pagination-centered link">
<a target="_blank" href="#">VK</a>
</div>
AND
<div class="col-md-12 center-block text-center pagination-centered link">
<a target="_blank" href="#">FB</a>
</div>
for vertical align use make a new class
.verticalcenter {
display: inline-block;
vertical-align: middle;
float: none;
}
and use it.
make your HTML structure like below:
First Row..
<div class="row center-block text-center">
<div class="center-block col-md-4">
</div>
<div class="center-block col-md-4">
</div>
<div class="center-block col-md-4">
</div>
</div>
Second Row..
<div class="row center-block text-center">
<div class="center-block col-md-4">
</div>
<div class="center-block col-md-4">
</div>
<div class="center-block col-md-4">
</div>
</div>
My webpage in desktop view is divided into a 2x3 layout i.e two rows with 3 grid-columns each (bootstrap rows and columns), as given in below:
**image1 image2 image3
image4 image5 image6**
<div class="row">
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image1.png"/>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image2.png"/>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image3.png"/>
</div>
</div>
<div class="row">
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image4.png"/>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image5.png"/>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<img src="image6.png"/>
</div>
</div>
When I reduce to a mobile size(col-xs), I want the page two be in a 2x3 layout, as given below:
**image1 image2
image3 image4
image5 image6**
Can this be achieved using the bootstrap framework?
Just add the declaration for the xs viewport in your column classes and make it a single row, like you see below. As long as the columns (and column offsets if you're using them) equal to 12, you can use a single row wrapper to make several rows worth of columns. I'm glad I could help.
<div class="row">
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image1.png"/>
</div>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image2.png"/>
</div>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image3.png"/>
</div>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image4.png"/>
</div>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image5.png"/>
</div>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4">
<img src="image6.png"/>
</div>
</div>
Example:
http://www.bootply.com/8JlDo3kXKH