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

Nesting with fluid grids

From: Up and Running with Bootstrap 2

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.

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.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 2
Up and Running with Bootstrap 2

32 video lessons · 20486 viewers

Jen Kramer
Author

 

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.

Join now Already a member? Log in

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 preferences from 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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.