Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Limit Bootstrap Column Width on Large Devices

Tags:

I have the following divs that use Bootstrap 3.0 CSS:

<div class="container">   <div class="row">     <div class="col-md-4">       ...     </div>     <div class="col-md-4">       ...     </div>     <div class="col-md-4">       ...     </div>   </div> </div> 

While this looks and behaves the way I want on XS to medium-sized devices, the expanded columns on large devices (>1200px) ruin my design.

Is there a way to stop bootstrap from expanding column width to 95px on large devices?

like image 774
Peter Avatar asked Dec 09 '13 12:12

Peter


People also ask

How we define grid for large devices in Bootstrap?

Bootstrap Grid - Large Devices Tip: Large devices are defined as having a screen width from 1200 pixels and above. For large devices we will use the . col-lg-* classes. Now Bootstrap is going to say "at the small size, look at classes with -sm- in them and use those.

How do I change the size of a column in Bootstrap?

This is done by adding the class “col-SIZE-SIZE_TO_OCCUPPY”. For example, . col-md-4 which means take 4 columns on the medium-sized screens. If we stack multiple column classes on a single element we can define how we want the layout to look like on other screens and change the columns to rows as we want.

What is the maximum number of columns that a Bootstrap grid can accommodate?

Bootstrap's grid system allows up to 12 columns across the page.

How we define grid for extra small devices in Bootstrap?

Bootstrap Grid - Small Devices Tip: Small devices are defined as having a screen width from 768 pixels to 991 pixels. For small devices we will use the . col-sm-* classes. Now Bootstrap is going to say "at the small size, look for classes with -sm- in them and use those".


1 Answers

Limiting the container width to max container width for medium devices (970px) will do the trick:

<div class="container" style="max-width: 970px;">   <div class="row">     <div class="col-md-4">       ...     </div>     <div class="col-md-4">       ...     </div>     <div class="col-md-4">       ...     </div>   </div> </div> 
like image 55
Cengiz Avatar answered Oct 26 '22 17:10

Cengiz