Saturday, 20 December 2014

Lễ truyền thống XVI

By default, Bootstrap's thumbnails are designed to showcase linked images with minimal required markup.

Highly customizable

With a bit of extra markup, it's possible to add any kind of HTML content like headings, paragraphs, or buttons into thumbnails.

  • Thumbnail label

    Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    Action Action

  • Thumbnail label

    Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    Action Action

  • Thumbnail label

    Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    Action Action

Why use thumbnails

Thumbnails (previously .media-grid up until v1.4) are great for grids of photos or videos, image search results, retail products, portfolios, and much more. They can be links or static content.

Simple, flexible markup

Thumbnail markup is simple—a ul with any number of li elements is all that is required. It's also super flexible, allowing for any type of content with just a bit more markup to wrap your contents.

Uses grid column sizes

Lastly, the thumbnails component uses existing grid system classes—like .span2 or .span3—for control of thumbnail dimensions.

Markup

As mentioned previously, the required markup for thumbnails is light and straightforward. Here's a look at the default setup for linked images:

  1. <ul class="thumbnails">
  2.  <li class="span4">
  3.  <a href="#" class="thumbnail">
  4.  <img src="http://placehold.it/300x200" alt="">
  5.  </a>
  6.  </li>
  7. ...
  8. </ul>

For custom HTML content in thumbnails, the markup changes slightly. To allow block level content anywhere, we swap the <a> for a <div> like so:

  1. <ul class="thumbnails">
  2.  <li class="span4">
  3.  <div class="thumbnail">
  4.  <img src="http://placehold.it/300x200" alt="">
  5.  <h3>Thumbnail label</h3>
  6.  <p>Thumbnail caption...</p>
  7.  </div>
  8.  </li>
  9. ...
  10. </ul>

More examples

Explore all your options with the various grid classes available to you. You can also mix and match different sizes.