How to Create Multiple Responsive Columns with Bootstrap 3

How to Create Multiple Responsive Columns with Bootstrap

Would you like to improve your website responsiveness with Bootstrap? The most important aspect of Bootstrap is its 12-column mobile first grid system. This is what you use to create a responsive layout.

In this video tutorial, you are going to create a basic website using Bootstrap and learn how to use Bootstrap grid system to create a responsive layout with multiple columns.

Before Watching the Tutorial

Before you are able to follow the video tutorial below and learn how to create your own responsive columns, you will need:

  • Basic understanding of what Bootstrap is
  • Basic understanding of what Bootstrap grid system is
  • Download Bootstrap to your hard drive
  • Create a basic Bootstrap index.html file to build upon

What Is Bootstrap

  • Bootstrap is a framework for HTML, CSS and JavaScript developers working on website responsiveness.
  • It consists of already pre-built responsive CSS styling for columns, lists, navigation, web forms and many other web elements.

Understanding Bootstrap Grid System

  • Bootstrap grid system classifies screen sizes into four types: Extra-small, Small, Medium and Large.
  • The Extra-small is for mobile phones. The Small is for tablets, like I-Pad. The Medium is for desktop monitors. And the Large is just for larger desktop monitors.
  • To help you fine tune responsiveness for these four types of screens, Bootstrap divides the width of web viewing devices into the 12-column grid system.
  • Every one of those four Bootstrap Grid types becomes responsive only if you assign to it its own designated CSS class.
  • For example, to make a div responsive for extra small devices, the div must have its own Bootstrap .col-xs-<number_of_columns_to_take> class, like <div class=”col-xs-6″>.

Downloading Bootstrap

  • Go to getboostrap.com and click on the “Download Bootstrap” button:
01 download bootstrap
  • You’ll see the “Getting Started” page. Click on the “Download Bootstrap” button:
02 download bootstrap button 02
  • Save this file to your computer hard drive, anywhere you want. It doesn’t have to be saved to a web server.
  • Unzip this file and rename the extracted folder to “bootstrap”.

Getting Ready Your Basic Bootstrap index.html Page

Step #1. Create Your Bootstrap index.html File

03 basic template link
  • You will see the “Basic template” code. Click on the “Copy” button to copy the code:
04 copy button
  • Paste the “Basic Template” code in your text editor and save it as index.html in the same folder, where you saved the “bootstrap” folder. It will now become your Bootstrap site front page.
  • Open the newly created index.html and take a look at your basic Bootstrap website:
05 initial bootstrap page
  • Open the index.html file in your text editor and between the opening <body> and <h1> tags add <div class=”container”> (1). Close this new div after the closing </h1> tag (2) and save the file:
06 container div
  • Check the page front end and notice how the “Hello World!” is not stuck to the edge of the page anymore and has now moved slightly to the right, to make it look a bit tidier. The Bootstrap’s “container” class you assigned to this div has added to this text some margin:
07 hello world taking container class
  • Go back to your index.html file. Between the <h1> and </h1> tags replace the “Hello World!” to “Trusthub”. Save the file and check your site front end.

Step #2. Add Some Content and a Sidebar

  • Get back to your index.html file and underneath the <h1>Trustub</h1> code copypaste the following code:
<div class="row">
<div>
<h2>What Trusthub can do for you</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.</p>
</div>
<div>
<h2>Our Team</h2>
<p>Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus.</p>
</div>
</div>
  • Go back to your site front end. Refresh it. You should now see your content and the “Our Team” sidebar, without columned responsive layout yet:
08 content and sidebar without bootstrap layout
  • Go back to the getbootstrap.com website and on the top menu click on the “CSS” button:
09 css button
  • On the sidebar click on the “Grid System” button:
10 grid system button
  • Scroll down the page to the “Grid options” section (1) and take note of the Bootstrap 12-column grid system with its four screen sizes types, their width and their designated CSS class prefixes (2):
11 grid options
  • Don’t worry if Bootstrap grid system options don’t make sense for you yet. It will all come together for you in a second when you start playing around them on your site.
  • Open up your index.html file once again and underneath the <div class=”row”>, for your existing <div> enter class “col-md-9”. Your new div now should look “div class=”col-md-9”>:
12 first col md 9 class
  • Now go to your div, located right above the <h2> “Out Team” header and give it the “col-md-3” Bootstrap grid CSS class. Save the file:
13 second col md 3 class
  • Go back to your site to see this change in action. Press F5 key on your keyboard to refresh your website. Now you will see that your content area and the sidebar are sitting side by side.
  • Your content div is now taking up 9 of the available in its Bootstrap grid 12 columns (75% of the whole desktop screen width). And your sidebar takes 3 of its Bootstrap grid 12 columns (25% of the whole desktop screen width):
14 content and sidebar side by side

Brilliant! You are now all set to follow the video tutorial bellow. Let’s get started.

Congratulations! You just learned how to create responsive web page layout with multiple columns using Bootstrap. Would you like to learn more about Bootstrap? If yes, please visit our OSTraining YouTube channel and watch the “Bootstrap Framework Tutorials“.

Author

  • Alex Smirnov

    Born from Ukrainian mother and Russian father, Alex migrated to the United Kingdom in 1999. He is a self-taught Microsoft Certified Professional. He enjoys learning content management systems and helping web site developers make the most of them.

0 0 votes
Article Rating
Subscribe
Notify of
1 Comment
Oldest
Newest
Inline Feedbacks
View all comments
Mansoor Ahmad
Mansoor Ahmad
5 years ago

Thank you so much it is too easy to implement now

1
0
Would love your thoughts, please comment.x
()
x