Implementation of Bootstrap media objects and bootstrap media objects

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.