Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Bootstrap 2

Nesting with fluid grids


From:

Up and Running with Bootstrap 2

with Jen Kramer

Video: Nesting with fluid grids

On occasion, you may want to segment a portion of the grid that you're working with into smaller pieces. For example, here's the web page that we built so far in this particular chapter, and inside of the Content area, maybe we'd like to have two information boxes appear side by side, underneath the two articles that are present. Unfortunately, since that particular part of the web page has a span of nine, in other words nine columns, I can't make two evenly-sized boxes, because one will be four columns wide and one would be five columns wide.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Up and Running with Bootstrap 2
2h 38m Beginner Oct 12, 2012

Viewers: in countries Watching now:

Bootstrap is a free web development tool from Twitter that, with a little bit of CSS and JavaScript experience, makes building websites quick, intuitive, and fun. Author Jen Kramer explores its 12-column grid layout; typography and icon libraries; fully functional components like nav bars, buttons, and tabs; and much more. This course also shows how to add JavaScript extras like dropdown menus, modal windows, and photo carousels.

Topics include:
  • Understanding the difference between default and fluid grids
  • Nesting with fluid grids
  • Creating a thumbnail gallery
  • Adding block quotes and lists of text
  • Incorporating images and icons
  • Adding breadcrumb navigation and pagination
  • Using tabs and pills navigation
  • Making the nav bar responsive with JavaScript
  • Adding dropdown menus to the nav bar, tabs, and pill
Subjects:
Web CMS Blogs Responsive Design Web Design
Software:
Bootstrap
Author:
Jen Kramer

Nesting with fluid grids

On occasion, you may want to segment a portion of the grid that you're working with into smaller pieces. For example, here's the web page that we built so far in this particular chapter, and inside of the Content area, maybe we'd like to have two information boxes appear side by side, underneath the two articles that are present. Unfortunately, since that particular part of the web page has a span of nine, in other words nine columns, I can't make two evenly-sized boxes, because one will be four columns wide and one would be five columns wide.

However, there is another approach that we can take to this. We could nest another row inside of the row so that we would have 12 columns to work with and then divide those 12 columns into 2 pieces of 6 columns each. This is called a nested row inside of Bootstrap. So I'm going to go ahead and implement one of these now. If you go back into Dreamweaver and open up your HTML web page, and I'm going to scroll on down past that second article here, and I'm going to add some more code.

So I'm going to add this as a section with a class of row fluid, and I'm going to put in a div with a class of span9 offset3, and let me just close those before I lose track of those two particular tags. So if I went ahead and put it in my boxes here, at this point we could have one that was four columns wide and one that was five-sized columns.

But I want are two evenly-sized boxes. So to do that, I'm just going inside div with a class of span9, offset3, I'm going to go ahead and add another row. So inside of this div, I'm going to go ahead and add another div with a class of row-fluid, just exactly the way we've done before, and then inside of that particular div I'll put in my two information boxes.

So I could put in here a div with a class of span6, and inside of that I can put an h3, and we'll call that Info Box 1, and perhaps I want an image to appear here. So I gave some images with the exercise files, you should have copied those into your images folder. So I can go ahead and add those here, image source, and I can browse for those files.

So inside of my images folder, I have art1, and I could put in a paragraph of information. Here is some text about the picture, and I'm just going to copy this one little chunk of code here, this div with a class of span6, I'm just going to do a Ctrl+C to copy it, and right after that /div, I'm going to paste that on in place. So we have Info Box number 2, and it will be art2 instead of art1.

So now we've gone ahead we've added an additional row to our grid, inside of that row we've nested another row, and so we have to make sure all of those divs are closed and everything is looking good, go ahead and do a File > Save, and now when you take a look at this inside of Firefox there's our two images with the text underneath, and we have our two articles that appear on the top. This is a great opportunity to show you the responsiveness of the Bootstrap grid as well, at this point.

Right now my browser window is maximized so it's occupying the full width of my particular screen in a very typical desktop configuration. If I resize my browser window slowly--I'm just going to grab the corner here and drag it on over--you'll see that my images are in fact actively resizing. That's part of the definition of a responsive website. You'll notice that the grid is resizing as well, continuously. You don't see it chunking as you move in to move the corner here, and it stays the same until it suddenly jumps to the next position. That would be an adaptive layout, that would sort of jump in between different sizes, but a responsive design should be continuous and smooth as you can see that this one is. And as I continue to go here, you'll see that the grid continues to adapt, so what you see going on here is at the very top of the screen, you see the left column where we had a span3 and the article with a span9, you see that those are actually stacked on top of each other, then underneath we had an offset of 3 with a span of 9 for those articles and for these info boxes.

So you see here, that there's still some space over on the left-hand side, that's why they are not lined up completely, and as I start to drag this on over a little bit further, you'll see that we continue to resize according to the page, until we reach some final amount here. Notice that those images are continuing to resize as well, and if I scroll on down the page, you can see that--I think I've probably gone past the maximum here a little bit-- but you can see that everything is appearing stacked on top of each other, which is the way that we would expect this grid to respond.

So now we've taken a look at the three critical aspects of this grid and how they work together, including the actual grid itself and how we create any rows in it, and we've taken a look at fluid offsetting--so the concept of having some items shifted over a bit on the page-- and finally, we've seen how we can nest a row inside of another row to achieve even finer control on that grid.

Find answers to the most frequently asked questions about Up and Running with Bootstrap 2.


Expand all | Collapse all
Please wait...
Q: I am trying to create the image carousels shown in this course, and they are not functioning properly. The custom.css file seems to be missing from the exercise files and I think this is the reason. Can you provide it?
A: custom.css isn't created until the carousel indicators are added. However, these styles have to do with the way the indicators look, and nothinghas to do with the way the carousel functions.
 
Are you sure you're working with Bootstrap 2.x? You download that from here: 
http://getbootstrap.com/2.3.2/. The carousel changed radically between Bootstrap 2.x and Bootstrap 3, and this course might not work with version 3.
Share a link to this course
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.
Upgrade now


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.

Upgrade now

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 2.

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
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



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.

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