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

Up and Running with Bootstrap 2
Illustration by
Watching:

Creating a thumbnail gallery


From:

Up and Running with Bootstrap 2

with Jen Kramer

Video: Creating a thumbnail gallery

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.

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 Responsive Design Web Design Web Development
Software:
Bootstrap
Author:
Jen Kramer

Creating a thumbnail gallery

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.

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

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

join now 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
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.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

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.