Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I'm looking at HTML file 03_06. Comes from your Exercise Files folder. Copy it into your Bootstrap folder, display it in the browser. And this is a new page, we haven't done any work to this page before. And what I've got going on here is a dog photo gallery over here on one side of the page, where I have a series of pictures here with text and then over here on the right side of the page I have some contact information which is actually in tabular format. I will be styling the contact information over here in the next video, but in this video what I'd like to do is I'd like to concentrate on this photo gallery which really doesn't look like a photo gallery at the moment, so what I would like to do then is combine the grid system that you already know with a few additional classes and we're going to wind up with a thumbnail gallery which is pretty darn cool if you think about it.
So I'm going to come on over here to Sublime Text and I'm going to scroll down here to row number two and this is around lines 27, 28. We have a series of images with paragraphs of information here. And so that's where we're going to be working. What I'm going to start with here. Is adding a grid system around these guys. So, around this first picture here then, I'm going to add a div with the class of row. And, then, we're going to go ahead and just indent all this text here.
And down here I'm going to end that row. Then the next thing I want to add is another div here, a div with a class of col-xs-6. So I'm going to go ahead and use my extra small grid system. And I'm going to wrap this unit around the image and the paragraph. Slash div. And indent once again, the image in the paragraph, to make everything line up here. So I'm going to repeat this process, this div with a class of call extra small 6.
And then we're going to indent image in the paragraph, and we're going to say slash div, and so forth. We're just going to repeat this a few times. So that every single one of these guys is going to have this div around it. And since we've got one row here with just the extra small grid in it. We can actually divide this into two rows, so I'm going to go ahead and add that here. It's a slash div for row number one, and a div with class of row here, just so that things are adding up to 12, even though they don't have to add up to 12, for the extra small grid system.
So, now that I've got those in place, let's just see what we've got so far. If I go ahead and save this page and I refresh my web browser. Already, that's looking pretty good. I've got my series of pictures here. I've got a little text underneath and things are looking good. As I make my page narrower, that photo gallery is still looking good all the way on down to these small mobile dimensions. And notice that I have a class of image-responsive on all of those images so that they are scaling properly as well. All right, so that's pretty good, but they still don't really look like thumbnails, per say, and the way that we actually turn these in to.
Things that look like thumbnails, as opposed to just sort of a grid of pictures with text is we're going to add a little bit of additional code. So, after the div with a class of col-xs-6, which is on line 29, I'm going to add one more div. With a class of thumbnail. And that div is going to wrap all the way around the image and the paragraph as well and then we'll end that div. So this is a lot of divs that are involved here. And then the last thing. If I just save this with this additional div with a class of thumbnail and put that in your browser you'll wind up getting this nice little border that goes around things.
But this caption isn't quite beautiful yet, either. So we can add, inside of the paragraph tag you can add a class of caption. Save that and then refresh your page again and we you'll see that we have a nice full caption here that is not shoved all the way on to the edge of the border here on our thumbnail. Now, this paragraph with the class of caption, because I only have one line of text here, I have taken the class of caption and I put it inside the paragraph. If I had a heading and a couple of paragraphs of information and so forth that were all associated with this thumbnail, I could put that classic caption inside of a div.
And wrap the div all the way around that instead. But because I just have one line of text here, I eliminated that extra div. I did try putting thumbnail inside of my grid here, so it was call extra small six and thumbnail together on the same div, and things didn't look quite right. So I think you really do have to break these out as separate divs in this particular case. All right, so if I go on through here my other examples in this page, adding this div of the class of thumbnail which would come right after the call extra small six and then adding this p with the class of caption, I'm just going to go ahead and do that here really quick.
Alright. So I've put in all my div with classes of thumbnail, I've put in all my Ps with class of caption. If you go ahead and save this now and come back to your browser and refresh you should then see four lovely thumbnails with captions that should stay lovely no matter how wide or how narrow the pages. And it looks like that that is working well here for us. There we go. So that is how you layout a thumbnail gallery using Bootstrap. What you might want to do at this point now? Is these little pictures should probably lead to something else.
You can either just do a simple link to a larger version of that picture, maybe on another web page, you can make use of Bootstrap's mobile windows, so that when you click these thumbnails, you know, it will come out on a mobile window or something. Just adding these thumbnails and the styling here. Makes these look like thumbnails that would be clickable and something that you would incorporate into your web page, but the functionality behind them isn't there yet. You're going to have to do some extra programming to make these truly functional thumbnails that you would click on and get a larger version of the image.
Get unlimited access to all courses for just $25/month.Become a member
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.
Your file was successfully uploaded.