0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/docs/components/media.md

105 lines
4.5 KiB
Markdown
Raw Normal View History

2014-07-13 09:59:31 +02:00
---
layout: page
title: Media
---
2014-07-13 10:12:11 +02:00
Abstract object styles for building various types of components (like blog comments, Tweets, etc) that feature a left- or right-aligned image alongside textual content.
2014-03-17 03:03:53 +01:00
2014-07-13 10:12:11 +02:00
### Default media
2014-03-17 03:03:53 +01:00
2014-07-13 10:12:11 +02:00
The default media allow to float a media object (images, video, audio) to the left or right of a content block.
{% example html %}
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
</div>
</div>
{% endexample %}
### Nested media
Media components can also be nested.
{% example html %}
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
2014-03-17 03:03:53 +01:00
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
2014-07-13 10:12:11 +02:00
<h4 class="media-heading">Nested media heading</h4>
2014-03-17 03:03:53 +01:00
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
</div>
</div>
</div>
</div>
2014-07-13 10:12:11 +02:00
{% endexample %}
### Media list
2014-03-17 03:03:53 +01:00
2014-07-13 10:12:11 +02:00
With a bit of extra markup, you can use media inside list (useful for comment threads or articles lists).
{% example html %}
<ul class="media-list">
<li class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
<p>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.</p>
<!-- Nested media object -->
<div class="media">
2014-03-17 03:03:53 +01:00
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
2014-07-13 10:12:11 +02:00
<h4 class="media-heading">Nested media heading</h4>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
2014-03-17 03:03:53 +01:00
<!-- Nested media object -->
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
<h4 class="media-heading">Nested media heading</h4>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
</div>
</div>
</div>
2014-07-13 10:12:11 +02:00
</div>
<!-- Nested media object -->
<div class="media">
<a class="pull-left" href="#">
2014-03-17 03:03:53 +01:00
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
</a>
<div class="media-body">
2014-07-13 10:12:11 +02:00
<h4 class="media-heading">Nested media heading</h4>
2014-03-17 03:03:53 +01:00
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
</div>
2014-07-13 10:12:11 +02:00
</div>
</div>
</li>
2014-03-17 03:03:53 +01:00
<li class="media">
2014-07-13 10:12:11 +02:00
<a class="pull-right" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="Generic placeholder image">
2014-03-17 03:03:53 +01:00
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
2014-07-13 10:12:11 +02:00
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
2014-03-17 03:03:53 +01:00
</div>
</li>
</ul>
2014-07-13 10:12:11 +02:00
{% endexample %}