The grid system of Bootstrap

 Aug 10, 2015

When working with Bootstrap it is good practice to utilise the grid system for the positioning of your controls. This grid is 12 columns wide at any point in time doesn’t matter in what element you are; it will always divide the parent element in 12 equal columns. This grid is adaptable depending on the resolution of the screen.

To give you an example of the grid the following example creates all twelve columns in a div element. Note that this spans the width of the parent element, in this case the div element.

Please take note that in this example we used the class called “col-md-1”, this uses the column class from the bootstrap style and assigns it a width of one column. This is flexible to meet your requirements.

For the next example I will create 4 columns of equal size across the whole page, to do this you divide the 12 column grid with the amount of columns you want (12 /4 = 3). This then gives you the size of the columns you need to create.

Each element on your page will have the grid system within it. We have full control over these columns and can even nest the columns within a child column.

For example in the following code I have two equal columns spanning the page, I then take the column on the left and divide it into 6 equal columns.

You are not required to use the full grid; you can specify only the columns that you need. I can easily create columns that meet certain size requirement and still not fill in the whole element.

The following example creates columns on the right side of the page and has three columns nested within it containing different sizes.

There is a lot more flexibility not mentioned here, but you can start experimenting with combinations to see different outcomes and use the layout that fits your requirements.

How do your Excel skills stack up?   

Test Now  

About the Author:

Auret Swanepoel  

As a recent addition to the New Horizons team, Auret is a highly skilled and qualified IT Technical trainer. He has been a Microsoft Certified Trainer (MCT) since 2008 and has since then, also become a Microsoft Certified Professional (MCP), a Microsoft Certified Technology Specialist (MCTS) and a Microsoft Certified Information Technology Professional (MCITP). With his international experience as a trainer in South Africa, Auret is able to adapt his teaching style to different audiences in the classroom and ensure that students are learning in a positive and collaborative environment.

Read full bio
top
Back to top