
- Bootstrap Tutorial
- Bootstrap - Home
- Bootstrap - Overview
- Bootstrap - Environment Setup
- Bootstrap with CSS
- Bootstrap - Grid System
- Bootstrap - CSS Overview
- Bootstrap - Typography
- Bootstrap - Code
- Bootstrap - Tables
- Bootstrap - Forms
- Bootstrap - Buttons
- Bootstrap - Images
- Bootstrap - Helper Classes
- Bootstrap - Responsive utilities
- Bootstrap Layout Components
- Bootstrap - Glyphicons
- Bootstrap - Dropdowns
- Bootstrap - Button Groups
- Bootstrap - Button Dropdowns
- Bootstrap - Input Groups
- Bootstrap - Navigation Elements
- Bootstrap - Navbar
- Bootstrap - Breadcrumb
- Bootstrap - Pagination
- Bootstrap - Labels
- Bootstrap - Badges
- Bootstrap - Jumbotron
- Bootstrap - Page Header
- Bootstrap - Thumbnails
- Bootstrap - Alerts
- Bootstrap - Progress Bars
- Bootstrap - Media Object
- Bootstrap - List Group
- Bootstrap - Panels
- Bootstrap - Wells
- Bootstrap Plugins
- Bootstrap - Plugins Overview
- Bootstrap - Transition Plugin
- Bootstrap - Modal Plugin
- Bootstrap - Dropdown Plugin
- Bootstrap - Scrollspy Plugin
- Bootstrap - Tab Plugin
- Bootstrap - Tooltip Plugin
- Bootstrap - Popover Plugin
- Bootstrap - Alert Plugin
- Bootstrap - Button Plugin
- Bootstrap - Collapse Plugin
- Bootstrap - Carousel Plugin
- Bootstrap - Affix Plugin
- Bootstrap Demos
- Bootstrap - Grid Demo
- Bootstrap - Table Demo
- Bootstrap - Form Demo
- Bootstrap - Buttons Demo
- Bootstrap - Images Demo
- Bootstrap - Responsive Demo
- Bootstrap - Navigation Demo
- Bootstrap - Blog Demo
- Bootstrap - Material Design Demo
- Bootstrap - Slider Demo
- Bootstrap - Time line Demo
- Bootstrap - Alert Demo
- Bootstrap - Admin Interface Demo
- Bootstrap - Ajax Demo
- Bootstrap - Tabbed slider Demo
- Bootstrap - Caption Demo
- Bootstrap - Map Demo
- Bootstrap - Calendar Demo
- Bootstrap - Social Icons Demo
- Bootstrap - Icons Demo
- Bootstrap - featured Demo
- Bootstrap Useful Resources
- Bootstrap - Questions and Answers
- Bootstrap - Quick Guide
- Bootstrap - Useful Resources
- Bootstrap - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Bootstrap - Thumbnails
This chapter discusses about Bootstrap thumbnails. A lot of sites need a way to lay out images, videos, text, etc, in a grid, and Bootstrap has an easy way to do this with thumbnails. To create thumbnails using Bootstrap −
Add an <a> tag with the class of .thumbnail around an image.
This adds four pixels of padding and a gray border.
On hover, an animated glow outlines the image.
The following example demonstrates a default thumbnail −
<div class = "row"> <div class = "col-sm-6 col-md-3"> <a href = "#" class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </a> </div> <div class = "col-sm-6 col-md-3"> <a href = "#" class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </a> </div> <div class = "col-sm-6 col-md-3"> <a href = "#" class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </a> </div> <div class = "col-sm-6 col-md-3"> <a href = "#" class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </a> </div> </div>
Adding Custom Content
Now that we have a basic thumbnail, it's possible to add any kind of HTML content like headings, paragraphs, or buttons into thumbnails. Follow the steps below −
Change the <a> tag that has a class of .thumbnail to a <div>.
Inside of that <div>, you can add anything you need. As this is a <div>, we can use the default span-based naming convention for sizing.
If you want to group multiple images, place them in an unordered list, and each list item will be floated to the left.
The following example demonstrates this −
<div class = "row"> <div class = "col-sm-6 col-md-3"> <div class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </div> <div class = "caption"> <h3>Thumbnail label</h3> <p>Some sample text. Some sample text.</p> <p> <a href = "#" class = "btn btn-primary" role = "button"> Button </a> <a href = "#" class = "btn btn-default" role = "button"> Button </a> </p> </div> </div> <div class = "col-sm-6 col-md-3"> <div class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </div> <div class = "caption"> <h3>Thumbnail label</h3> <p>Some sample text. Some sample text.</p> <p> <a href = "#" class = "btn btn-primary" role = "button"> Button </a> <a href = "#" class = "btn btn-default" role = "button"> Button </a> </p> </div> </div> <div class = "col-sm-6 col-md-3"> <div class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </div> <div class = "caption"> <h3>Thumbnail label</h3> <p>Some sample text. Some sample text.</p> <p> <a href = "#" class = "btn btn-primary" role = "button"> Button </a> <a href = "#" class = "btn btn-default" role =" button"> Button </a> </p> </div> </div> <div class = "col-sm-6 col-md-3"> <div class = "thumbnail"> <img src = "/bootstrap/images/kittens.jpg" alt = "Generic placeholder thumbnail"> </div> <div class = "caption"> <h3>Thumbnail label</h3> <p>Some sample text. Some sample text.</p> <p> <a href = "#" class = "btn btn-primary" role = "button"> Button </a> <a href = "#" class = "btn btn-default" role = "button"> Button </a> </p> </div> </div> </div>