Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 grid, set 1 column size for all displays

Tags:

In bootstrap v3, the column sizes are declared for different screen sizes..

<div class='container'>     <div class='row'>         <div class='col-md-6 col-lg-6 col-sm-6'> 

I often find myself just needing 1 size for all display types.. and i thought this would be something like

        <div class='col-6'> 

where no matter what display size the user is on, just keep the width of the column 6/12 of the grid system.. but this doesn't seem to work. What am I missing?

like image 432
BrownChiLD Avatar asked Jan 31 '14 14:01

BrownChiLD


People also ask

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 does Col MD 12 mean?

In short, they are used to define at which screen size that class should apply: xs = extra small screens (mobile phones) sm = small screens (tablets) md = medium screens (some desktops) lg = large screens (remaining desktops)

How do I change the grid size in Bootstrap?

Go to the Customize menu on Bootstrap website and choose your preferred size. In Less Variables -> Grid system you can find a form to input your preferred sizes. Then you can easily download the preferred grid. Hope this will help.

What is offset 3 in Bootstrap?

offset-md-3 which will offset the desired column element with 3 columns to the right from its default position on medium screen sizes and above. . offset classes always shifts its content to the right. This all stuff produced results .


2 Answers

The correct answer for those sizes is <div class='col-sm-6'>. This will apply to sm and everything larger than it.

However, there is a fourth size - xs - so using <div class='col-xs-6'> would apply to every possible size.

like image 84
ZAD-Man Avatar answered Oct 30 '22 02:10

ZAD-Man


I haven't tested this so it may be wrong. I remember having an issue with col-lg-8 working but when the screen got to medium it all changed. Changing the class to col-md-8 then worked for both.

Using that logic, try setting the class to the smallest you want and see it it inherits upwards.

like image 44
Lotok Avatar answered Oct 30 '22 03:10

Lotok