Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.