Implementation of Bootstrap media objects and bootstrap media objects
On a web page, the picture is left and the content is arranged right. It is a very common effect, that is, a media object. It is an abstract style, it can be used to build different types of components. The corresponding version files in the bootstrap framework are as follows:
LESS: media. less
SASS: _ media. scss
Media objects are generally grouped. A group of media objects generally includes the following parts:
1. media object container: used to hold all content of a media object. The container must use the class name. media
2. media object: generally an image. You need to use the class. media-object.
3. Subject of a media object: it is the subject content of a media object. It can be any element and requires class. media-body.
4. media object title: used to describe a title of a media object. You must use the class. media-heading
In addition, the bootstrap framework usually uses the class. pull-left and. pull-right to control the object floating mode in the media object.
The following is their css source code:
.media,.media-body {overflow: hidden;zoom: 1;}.media,.media .media {margin-top: 15px;}.media:first-child {margin-top: 0;}.media-object {display: block;}.media-heading {margin: 0 0 5px;}.media > .pull-left {margin-right: 10px;}.media > .pull-right {margin-left: 10px;}
Media styles are relatively simple, but the spacing between them is set;
Let's take a look at the use of media objects:
<H1> default media object
Nesting of media objects
The bootstrap media object is nested. You only need to place the structure of another media object in the body of the media object (. media-body. Next let's take a look at the use of nested media objects.
<H1> nesting of default media objects
The effect is as follows:
Media Object List
The bootstrap framework displays a list of media objects. When writing a structure, you can use the ul tag and add the class name to the ul tag. media-list, class used on label li. media
For example:
<H1> media object list
The effect is as follows: