Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Exploring Bootstrap's grid system

From: Up and Running with Bootstrap 3

Video: Exploring Bootstrap's grid system

Bootstrap ships with a 12 column grid system. It's a mobile first grid. Meaning that it's designed for you to think about small screen design first. And then think about the larger desktop designs afterwards. And there are four sizes to this grid now. Rather than before, with Bootstrap, where we just had basically, going horizontally across the page or it went vertically. We now have four grid sizes. You can learn all about this grid system, if you go to GetBootstrap.com. Click on the link in the top navigation for CSS. And then click on the link on the side here for the Grid System.

Exploring Bootstrap's grid system

Bootstrap ships with a 12 column grid system. It's a mobile first grid. Meaning that it's designed for you to think about small screen design first. And then think about the larger desktop designs afterwards. And there are four sizes to this grid now. Rather than before, with Bootstrap, where we just had basically, going horizontally across the page or it went vertically. We now have four grid sizes. You can learn all about this grid system, if you go to GetBootstrap.com. Click on the link in the top navigation for CSS. And then click on the link on the side here for the Grid System.

And this will give you a full explanation of how the grid system works, media queries associated with it and so forth. If you scroll on down here to Grid > Options, this is going to explain to you the four sizes of grid that come with Bootstrap. It's worth noting that it starts with the extra small grid system, designed for very small devices like phones. So less than 768 pixels, when your screen is that large, it will be under control of the extra small grid system. And that grid is designed to be horizontal at all times.

Then there's three other sizes that are designed to be horizontal. And at the break points, which are specified underneath the name of each of those grid systems on the top there. Greater than or equal to 768 for small devices. Greater than or equal to 992 pixels for medium devices and greater than or equal to 1200 pixels for large devices. Those are the points where the grid is going to go horizontally across the page. As the grid goes narrower, the small, medium and large grids will simply stack vertically.

So if you think of three boxes going across the page, when you make the page narrower, those three boxes will then stack and go vertically. And if you keep on going down the page here, Bootstrap's going to give you some examples of the grid systems and how they work. I found these all fairly confusing, actually. It took me a little while to understand what Bootstrap is doing. So, I've written an example page for you. We are in chapter 2, and we're going to go to 02 01. You'll find a file here called grid.html. If you will copy that file and then paste it into your Bootstrap folder at the same level as index.html.

Just go ahead and drop in that grid file and then open that up in your browser. You can follow along with me. And you'll see here this is my master example grid. So, what I've tried to do here is, I have built out one row using these various grid systems. And making use of some of the classes that come with Bootstrap, I've tried to demonstrate for you how exactly this grid system works. So this video is being recorded at 1360 by 768 pixels. So, 1360 of course is greater than 1200.

And I've fully maximized my browser here, so at 1360 pixels, all of these grids are going horizontally across the page. As I'm going to make my browser narrower here, you're going to see how these various grid systems start to react. What I have here to show you is this very first row, is actually coded with all four grid systems. And then depending on the screen resolution for the width, it's going to display the name of the grid that's in use inside each of the cells. So, right now it says call, dash, large, dash four in each of those cells.

That's because we're working with the large grid system at the moment. Underneath the other four grids that you see here, are coded with one grid system alone. Either the extra small, the small, the medium, or the large grid. That way you can see how all of the grids can work together. And you also can see how each of those grids are working individually on this page. Alright, so I'm going to now take my screen here off of that maximum. Here we are at something slightly less than 1360 pixels. And as I start to minimize the size of this page here, you're going to notice we get to a break point, which happened right there.

That's probably around 1200 pixels. Watch this top row here very carefully. See how we've gone from the large grid system here. As I pull this corner in just a little bit and we hit that break point. Notice that the contents of those grids now read that it's medium grid. And that's because I have used some of the visibility classes that ship with Bootstrap to hide the words that said large. And show the grids that show medium, so that's how I changed the text. You'll notice the text above here also changed to indicate that we're now at this next break point and we're sort of between 1200 and 992 pixels.

And you'll notice that down here at the bottom of the page, the large grid by itself is now stacking vertically. So the large grid in, in absence of any other forces acting upon it would simply stack vertically like this. Whereas the other grids are still going horizontally across the page. Now, because I combined those grids here in this first bar across the top of the page. You see here that it's now under control of the medium grid system. The large grid system is no longer in effect. So I'm going to make the page smaller again. And we're going to hit another break point here in just a second.

There we go. So, at this break point, we've now passed that 992 pixel break point. We're now at something between 992 and 768 pixels. So we're working on the small grid at this point. So once again, if you take a look at the medium grid or the large grid. These are now stacked vertically across the page. Whereas if you take a look up here at the top of the page, we're now working with the small grid. You'll also notice in my master grid here, I've changed the distribution of those columns along the way.

So, the layout of those columns is changing as I go here. That's certainly not required. But it's an option that you can take advantage of while working with these grid systems. Alright, so now I'm going to make this page a little smaller again. Until I hit my next break point, right around in here somewhere. There we go. So, now we're on the extra small grids system. We're at less than 768 pixels. So, the small, medium and large grids are all going vertically across the page. The extra small grid is still staying horizontal, because remember the extra small grid always stays horizontal.

So as I make this page even narrower, you'll see that even when I get ridiculously narrow like this, I only have a few words across going on the page. My extra small grid is still going horizontally across page, even when the contents they're in are obviously too large for that particular cell. We've actually got content hanging outside of that grid. So, now that you see how this works visually, let's take a look at this in terms of the HTML. So if you will open up grid.html here inside of Sublime text, you'll see exactly how I put this together.

So, I have a little bit of styling up here at the top of the page. This is just for my example. Just to add a little bit more padding and some colors, so that you can see these grids on the page. And then if you scroll on down here into the main body, you'll see the actual code that I've used to put this together. So, here at lines 45 through 48, you'll notice these are paragraphs with various classes that are associated with them. So I have visible large, visible medium, visible small, and visible extra small. These classes are designed to show this particular content only at the media queries that correspond with those various grid sizes.

So I have four sentences that are actually here on the page. And all of the four sentences are loading in the HTML. But only one sentence is being displayed depending where I am and the screen resolution. Likewise down here, starting around line 50 this is the code for these various grids. I'm going to go through all of this code with you. But I just want you to take a quick peek at how this is put together. Notice that we start a row here at line 50. And then inside of that we have our various individual cells.

And those cells are starting at lines 51, 57 and 63. And we had specified here a number of different classes all together. Because remember, you can have multiple classes on an individual HTML element. And we've combined those individual classes, in such a way that the grid is going to change its distribution and its sizing depending on what our immediate query is doing. So that's the master grid there where I've combined all four of those grid systems together. Then further down on the page here, these are the individual examples in which I call only one of the grid systems.

Alright, so it's possible that you can use all four of the grid systems together in what you're doing. Or you can use just one. Or you could use two of the grid systems. Or you can use three of the grid systems. It's completely dependent on your design and what you're trying to achieve from your page. And how you think things look on the page at the various, different resolutions. As to which grid system is the right grid system for you to use, at which particular points in time. It's all very, very subjective. I wish I could give you a lot of great rules and just say just forget about these grids and only use these grids.

But it really boils down to, how do things look and how do you want them presented on various devices. I think you're going to get more of a sense of that as we go through this chapter on the grid system. So in the next video we'll start writing our own grid.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 3
Up and Running with Bootstrap 3

37 video lessons · 23217 viewers

Jen Kramer
Author

 
Expand all | Collapse all
  1. 5m 25s
    1. Welcome
      58s
    2. Using the exercise files
      1m 19s
    3. Installing Sublime Text 2
      3m 8s
  2. 29m 0s
    1. What is Bootstrap?
      8m 1s
    2. Downloading and unzipping Bootstrap 3
      4m 31s
    3. Examining Bootstrap file structure
      4m 34s
    4. Adding CSS to a Bootstrap HTML file
      4m 35s
    5. Adding JavaScript to a Bootstrap HTML file
      7m 19s
  3. 44m 38s
    1. Exploring Bootstrap's grid system
      9m 10s
    2. Creating new rows and cells
      14m 5s
    3. Adjusting column widths using offset
      5m 2s
    4. Changing column order using push and pull
      5m 34s
    5. Nesting columns
      3m 43s
    6. Creating a JumboTron-style layout
      3m 41s
    7. Challenge: Working with grids
      1m 31s
    8. Solution: Working with grids
      1m 52s
  4. 53m 34s
    1. Exploring basic typography: The small and blockquote tags
      4m 29s
    2. Exploring Bootstrap's responsive classes including .hidden and .visible
      4m 44s
    3. Styling buttons using btn classes
      4m 43s
    4. Styling images with responsiveness and decorative touches
      5m 22s
    5. Incorporating Bootstrap 3 glyph icons
      3m 28s
    6. Creating a thumbnail gallery
      6m 2s
    7. Styling tabular data
      5m 3s
    8. Overriding core CSS with custom styles
      12m 53s
    9. Challenge: Styling panels and callouts
      2m 17s
    10. Solution: Styling panels and callouts
      4m 33s
  5. 27m 41s
    1. Implementing location breadcrumbs
      6m 38s
    2. Using tabs and pills for navigation
      6m 58s
    3. Developing a responsive navigation bar
      9m 9s
    4. Challenge: Modify the "pancake" button
      1m 3s
    5. Solution: Modify the "pancake" button
      3m 53s
  6. 37m 45s
    1. Implementing dropdowns within a navigation bar
      5m 5s
    2. Tabbing within the same page
      15m 45s
    3. Accordion panels with collapse functionality
      11m 37s
    4. Challenge: Tooltips
      1m 59s
    5. Solution: Tooltips
      3m 19s
  7. 3m 0s
    1. Next steps towards advanced Bootstrap
      3m 0s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 3.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.