Thumbnail galleries are useful for displaying many images on a web page where the image is the main focus. You can usually click on these to get a larger version of the image. You can also use a thumbnail gallery for displaying photos and text on a page in an organized manner. Bootstrap does include some markup for creating a thumbnail gallery. And let's go ahead and take a look at that now. So if you hop back into Dreamweaver again, and we're going to scroll on down here, past the div class row-fluids, in this final/div right here.
I am going to go ahead and add another row to my document. So to do that, once again, I'm going to make another div class of row-fluid, make sure of course that you close that div somewhere further down the page. And inside of this particular div, the markup that we're going to use for thumbnails is an unordered list. So I'm going to go ahead and start that with a UL, and I'm going to give that a class of thumbnails.
Of course, don't forget your /ul somewhere down at the bottom. Once that's in place, the next thing we need to add is an li. This li, I'm going to have three thumbnails on my page. I want to have them all very next to each other in three columns. Since of course, we're working with rows and a 12-column grid, that would indicate that we need have a span of 4. So we're going to have an li with a class of span4 and of course our /li.
Now within that I'm going to have a picture, I'm going to have a heading, and I'm going to have some text. And all of those together could be considered an article. So we are going to use the article markup for that. So we're going to give it an article with a class of thumbnail, and inside of that we'll put in our image. Once again, we can browse for that. The first one we're going to put is Jonathan Ferrar.
So I'm going to go ahead and pick his photo here, make sure to give it an Alt tag, then we can go ahead and give this h3 for markup, Jonathan Ferrar, followed by some text. So the text is available to you in your exercise files, here we go, the very first one. Go ahead and copy that text-- Ctrl+C or Command+C to copy.
I'm going to put this is in as a paragraph and then Ctrl+V or Command+V to paste that on in and /p. So that's our first thumbnail there in our grid. We have a single li; we have an article inside of that. If an article isn't appropriate to what you are doing, you could use a div or any other tag that is appropriate to nest inside of that li. I've put in my image, my h3, and my p. Now if you're doing this as a real thumbnail gallery in which you just have pictures, you don't have text following it the way I do here, where I have article class of thumbnail, you could use that as an href, that might link to the larger version of the thumbnail.
The class for that href would still be Thumbnail, but you wouldn't have any of the text following this. The problem with doing that here in this type of context is that h3 and p are block level HTML tags. And you cannot nest the block level HTML tag inside of an in-line element like the A tag. So in this particular case, I'm using the article class here for containing those block level elements. I could certainly wrap an A tag around my image if I wanted to do that to make my image clickable.
Okay, so now that I've got that unit in place, so I'm going to go ahead and copy just highlight those lines for the li and then Ctrl+C or Command+C to copy, hit enter a couple times, and Ctrl+V or Command+V to paste it in. And then what I'm going to do--get my indentation there. Then I'm going to go ahead and make a couple of changes for my next one of these. Jennifer Jerome is the next one up here, so I'm going to change the h3 here to Jennifer Jerome. I am going to change my image source here and go ahead and browse for Jerome, change my Alt tag, Jennifer Jerome, and then from the document here in your exercise files, go ahead and copy the text here--Ctrl+C or Command+C to copy and Ctrl or Command+V to paste-- and then finally, one more time, go ahead and highlight that li, Ctrl+C or Command+C to copy and then Ctrl or Command+V to paste it in one more time, and we'll make these changes again.
So the last one that we're dealing here is LaVonne LaRue, so go ahead and copy that text here, paste that into my Dreamweaver document, and put in LaVonne LaRue's right here. And then, of course, we need to change the image source and pick LaVonne LaRue from our images folder and change the alt tag.
All right, so if we go ahead and we say File > Save, now we can go ahead and preview this in the browser, preview in Firefox, and we have something actually starting to look like a real web page. There's that hero unit at the top which we put together in the last video, underneath you see we have three thumbnails, right there one next to the other, some text that's placed right underneath all of those. If I make windows smaller, you can see that these thumbnails do resize. As we've discussed before, it is a responsive design that the images resize as they're required to do.
And at some point, those images will cascade down so that they're stacked underneath each other as part of that grid collapsing as the screen size gets smaller. And as you can see, we can narrow that screen all the way down to the 320-pixel range, which is where a mobile phone would be. And you can see that those are all stacked underneath each other nicely. So the Thumbnail Galleries are very, very useful. You use them in a lot of different websites. I've shown you a Thumbnail Gallery here. We've had some descriptive text following each of these.
You can certainly build a Thumbnail Gallery with smaller thumbnails, with images that link, and perhaps open a modal window or open in some kind of pop-up window that would show you a larger version of the picture. All of that is possible with Bootstrap.
- 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
- Adding dropdown menus to the nav bar, tabs, and pill