最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

老生常談Bootstrap媒體對象

 更新時間:2017年07月06日 08:46:33   投稿:jingxian  
下面小編就為大家?guī)硪黄仙U凚ootstrap媒體對象。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

前面的話

在Web頁面或者說移動頁面制作中,常??吹綀D文混排效果,圖片居左(或居右),內(nèi)容居右(或居左)排列。常常把這樣的效果稱為媒體對象。可以說它是一種抽象的樣式,可以用來構(gòu)建不同類型的組件。本文將詳細介紹Bootstrap媒體對象

默認樣式

媒體對象一般是成組出現(xiàn),而一組媒體對象常常包括以下幾個部分:

☑ 媒體對像的容器:常使用“media”類名表示,用來容納媒體對象的所有內(nèi)容

☑ 媒體對像的對象:常使用“media-object”表示,就是媒體對象中的對象,常常是圖片

☑ 媒體對象的主體:常使用“media-body”表示,就是媒體對像中的主體內(nèi)容,可以是任何元素,常常是圖片側(cè)邊內(nèi)容

☑ 媒體對象的標題:常使用“media-heading”表示,就是用來描述對象的一個標題,此部分可選

除了上面四個部分之外,在Bootstrap框架中還常常使用“media-left”或者“media-right”來控制媒體對象中的對象浮動方式

[注意]在 html 結(jié)構(gòu)中, .media-right 應(yīng)當放在 .media-body 的后面

媒體對象樣式相對來說比較簡單,只是設(shè)置他們之間的間距

.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-left {
 margin-right: 10px;
}
.media-right {
 margin-left: 10px;
}
<div class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=100 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>好的代碼像粥一樣,都是用時間熬出來的</div>
  </div>
</div>

嵌套

在評論系統(tǒng)中,經(jīng)常會有媒體對象嵌套的需求。在Bootstrap框架中的媒體對象也具備這樣的功能,只需要將另一個媒體對象結(jié)構(gòu)放置在媒體對象的主體內(nèi)“media-body”

<div class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=100 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>好的代碼像粥一樣,都是用時間熬出來的</div>
    <div class="media">
      <a class="pull-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
        <img class="media-object" src="http://via.placeholder.com/100x100" alt="...">
      </a>
      <div class="media-body">
        <h4 class="media-heading">我是小火柴</h4>
        <div>好巧啊,我也叫小火柴</div>
        <div class="media">
          <a class="pull-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
            <img class="media-object" width=100 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
          </a>
          <div class="media-body">
            <h4 class="media-heading">小火柴的藍色理想</h4>
            <div>是的</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=100 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>藍色理想衰落了,前端卻欣欣向榮起來</div>
  </div>
</div>

對齊方式

圖片或其他媒體類型可以頂部、中部或底部對齊。默認頂部對齊。通過.media-middle或.media-bottom來設(shè)置

.media-middle {
  vertical-align: middle;
}
.media-bottom {
  vertical-align: bottom;
}
<div class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=30 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>藍色理想衰落了,前端卻欣欣向榮起來</div>
  </div>
</div>
<div class="media">
  <a class="media-left media-middle" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=30 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>藍色理想衰落了,前端卻欣欣向榮起來</div>
  </div>
</div>
<div class="media">
  <a class="media-left media-bottom" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=30 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>藍色理想衰落了,前端卻欣欣向榮起來</div>
  </div>
</div>

媒體對象列表

媒體對象的嵌套僅是媒體對象中一個簡單應(yīng)用效果之一,在很多時候,我們還會碰到一個列表,每個列表項都和媒體對象長得差不多。Bootstrap框架提供了一個列表展示的效果,在寫結(jié)構(gòu)的時候可以使用ul,并且在ul上添加類名“media-list”,而在li上使用“media”

媒體對象列表,在樣式上也并沒有做過多的特殊處理,只是把列表的左間距置0以及去掉了項目列表符號

.media-list {
 padding-left: 0;
 list-style: none;
}
<ul class="media-list">
 <li class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=30 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>藍色理想衰落了,前端卻欣欣向榮起來</div>
  </div>
 </li>
 <li class="media">
  <a class="media-left" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
    <img class="media-object" width=30 src="http://img.jbzj.com/file_images/article/201707/huochai.jpg" alt="...">
  </a>
  <div class="media-body">
    <h4 class="media-heading">小火柴的藍色理想</h4>
    <div>好的代碼像粥一樣,都是用時間熬出來的</div>
  </div>
 </li> 
</ul>

以上這篇老生常談Bootstrap媒體對象就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

霍州市| 昭平县| 淮阳县| 黄石市| 胶州市| 石棉县| 西贡区| 卓资县| 宜阳县| 宕昌县| 安溪县| 龙游县| 嘉定区| 额尔古纳市| 德清县| 泊头市| 千阳县| 冕宁县| 章丘市| 荥经县| 涟水县| 麟游县| 景泰县| 通城县| 乐山市| 邛崃市| 桃源县| 塔城市| 无为县| 板桥市| 石棉县| 砚山县| 永昌县| 呈贡县| 青田县| 阿克陶县| 高唐县| 贵阳市| 广东省| 崇阳县| 巨野县|