【Bootstrap V4系列】學習入門教程之 組件-媒體對象(Media object)

Bootstrap V4系列 學習入門教程之 組件-媒體對象(Media object)

  • 媒體對象(Media object)
    • 一、Example
    • 二、Nesting 嵌套
    • 三、Alignment 對齊
    • 四、Order 順序
    • 五、Media list 媒體列表

媒體對象(Media object)

Bootstrap媒體對象的文檔和示例,用于構建高度重復的組件,如博客評論、推文等。

一、Example

媒體對象有助于構建復雜和重復的組件,其中一些媒體與不圍繞所述媒體的內容放在一起。此外,由于flexbox,它只需要兩個必需的類就可以做到這一點。

下面是一個單一媒體對象的示例。只需要兩個類——內容周圍的.media.media-body 正文。可選的填充和邊距可以通過間距實用程序進行控制。

<!--Example-->
<div class="media"><img src="../images/2.jpg" class="mr-3" alt="..."><div class="media-body"><h5 class="mt-0">Media heading</h5><p>Will you do the same for me? It's time to face the music I'm no longer your muse. Heard it's beautiful, be the judge and my girls gonna take a vote. I can feel a phoenix inside of me. Heaven is jealous of our love, angels are crying from up above. Yeah, you take me to utopia.</p></div>
</div>

頁面展示效果:

在這里插入圖片描述

二、Nesting 嵌套

媒體對象可以無限嵌套,但我們建議您在某個時候停止。將嵌套的.media放入父媒體對象的.media-body 正文中。

<!--嵌套 Nesting-->
<div class="media"><img src="../images/a1.jpg" class="mr-3" alt="..."><div class="media-body"><h5 class="mt-0">Media heading</h5><p>Standing on the frontline when the bombs start to fall. Heaven is jealous of our love, angels are crying from up above. Can't replace you with a million rings. Boy, when you're with me I'll give you a taste. There’s no going back. Before you met me I was alright but things were kinda heavy. Heavy is the head that wears the crown.</p><div class="media mt-3"><a class="mr-3" href="#"><img src="../images/1.jpg" class="mr-3" alt="..."></a><div class="media-body"><h5 class="mt-0">Media heading</h5><p>Greetings loved ones let's take a journey. Yes, we make angels cry, raining down on earth from up above. Give you something good to celebrate. I used to bite my tongue and hold my breath. I'm ma get your heart racing in my skin-tight jeans. As I march alone to a different beat. Summer after high school when we first met. You're so hypnotizing, could you be the devil? Could you be an angel? It's time to bring out the big balloons. Thought that I was the exception. Bikinis, zucchinis, Martinis, no weenies.</p></div></div></div>
</div>

頁面展示效果:

在這里插入圖片描述

三、Alignment 對齊

媒體對象中的媒體可以與flexbox實用程序對齊到.Media-body 正文內容的頂部(默認)、中間或末尾。

  • 頂部(默認)對齊方式:
<div class="media"><img src="..." class="align-self-start mr-3" alt="..."><div class="media-body"><h5 class="mt-0">Top-aligned media</h5><p>I’m gon’ put her in a coma. You give a hundred reasons why, and you say you're really gonna try. So I sat quietly, agreed politely. Suiting up for my crowning battle. And on my 18th Birthday we got matching tattoos. So très chic, yeah, she's a classic. I am ready for the road less traveled.</p><p>I'm walking on air (tonight). But down to earth. You're original, cannot be replaced. But in another life I would be your girl. We drove to Cali and got drunk on the beach. We can dance, until we die, you and I, will be young forever. Saw you downtown singing the Blues.</p></div>
</div>

頁面展示效果:

在這里插入圖片描述

  • 中間對齊方式:
<div class="media"><img src="..." class="align-self-center mr-3" alt="..."><div class="media-body"><h5 class="mt-0">Center-aligned media</h5><p>She'll turn cold as a freezer. At the eh-end of it all. Stinging like a bee I earned my stripes. Bikinis, zucchinis, Martinis, no weenies. I hope you got a healthy appetite. We can dance, until we die, you and I, will be young forever. We're living the life. We're doing it right. Word on the street, you got somethin' to show me, me.</p><p class="mb-0">Wanna see the show in 3D, a movie. They say, be afraid you're not like the others, futuristic lover. Open up your heart. So I sat quietly, agreed politely. Last Friday night. Yeah, you're lucky if you're on her plane. I'll be your gift, give you something good to celebrate.</p></div>
</div>

頁面展示效果:

在這里插入圖片描述

  • 末尾對齊方式:
<div class="media"><img src="..." class="align-self-end mr-3" alt="..."><div class="media-body"><h5 class="mt-0">Bottom-aligned media</h5><p>Come on, let your colours burst. I can feel this light that's inside of me. All night they're playing, your song. From Tokyo to Mexico, to Rio. There’s no going back. But down to earth. Magical, colorful, Mr. Mystery, ee. Different DNA, they don't understand you.</p><p class="mb-0">But down to earth. She's got that, je ne sais quoi, you know it. I can see the writing on the wall. The boys break their necks try'na to creep a little sneak peek. Take me, ta-ta-take me. Open up your heart. Thought that I was the exception. Boom, boom, boom. Venice beach and Palm Springs, summertime is everything. Bring the beat back. (This is how we do)</p></div>
</div>

頁面展示效果:

在這里插入圖片描述

四、Order 順序

通過修改HTML本身或添加一些自定義的flexbox CSS來設置order屬性(為您選擇的整數),從而更改媒體對象中內容的順序。

<!--Order-->
<div class="media"><div class="media-body"><h5 class="mt-0 mb-1">Media object</h5><p>I know there will be sacrifice but that's the price. Are you brave enough to let me see your peacock? Be your teenage dream tonight. Uh-huh, I see you. There’s no going back. Yeah, we maxed our credit cards and got kicked out of the bar. So let me get you in your birthday suit. You may fall in love when you meet her. Had the world in the palm of your hands. Don't let the greatness get you down, oh, oh yeah. Now we talking astrology, getting our nails did, all Japanese-y. Make me your Aphrodite.</p></div><img src="../images/2.jpg" class="ml-3" alt="...">
</div>

頁面展示效果:

在這里插入圖片描述

五、Media list 媒體列表

因為媒體對象的結構要求很少,所以您也可以在列表HTML元素上使用這些類。在您的<ul><ol>上,添加未設置樣式的.list-unstyled 以刪除任何瀏覽器默認列表樣式,然后將.media應用于您的<li>s。與往常一樣,在需要微調的地方使用間距實用程序。

<!--Media list-->
<ul class="list-unstyled"><li class="media"><img src="../images/2.jpg" class="mr-3" alt="..."><div class="media-body"><h5 class="mt-0 mb-1">List-based media object</h5><p>All my girls vintage Chanel baby. So you can have your cake. Tonight, tonight, tonight, I'm walking on air. Slowly swallowing down my fear, yeah yeah. Growing fast into a bolt of lightning. So hot and heavy, 'Til dawn. That fairy tale ending with a knight in shining armor. Heavy is the head that wears the crown.</p></div></li><li class="media my-4"><img src="../images/a1.jpg" class="mr-3" alt="..."><div class="media-body"><h5 class="mt-0 mb-1">List-based media object</h5><p>Maybe a reason why all the doors are closed. Cause once you’re mine, once you’re mine. Be your teenage dream tonight. Heavy is the head that wears the crown. It's not even a holiday, nothing to celebrate. A perfect storm, perfect storm.</p></div></li><li class="media"><img src="../images/1.jpg" class="mr-3" alt="..."><div class="media-body"><h5 class="mt-0 mb-1">List-based media object</h5><p>Are you brave enough to let me see your peacock? There’s no going back. This is the last time you say, after the last line you break. At the eh-end of it all.</p></div></li>
</ul>

頁面展示效果:

在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/80597.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/80597.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/80597.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

解決VirtualBox中虛擬機(ubuntu)與主機(windows)之間互相復制粘貼(文本)

一.開始的設置 1.在VirtualBox中打開設置&#xff0c;常規中修改主機與虛擬機交互設置 2.虛擬機關閉狀態下&#xff0c;存儲中選中控制器SATA&#xff0c;勾選‘使用主機輸入輸出’ 3.選中操作系統對應的虛擬文件&#xff0c;.vdi文件&#xff0c;勾選右邊的固態驅動器。 4.啟…

java 多核,多線程,分布式 并發編程的現狀 :從本身的jdk ,到 spring ,到其它第三方。

Java 在多核、多線程和高性能編程領域提供了豐富的現成框架和工具&#xff0c;既有標準庫中的并發組件&#xff0c;也有第三方框架。以下是一些關鍵框架及其應用場景的總結&#xff1a;便于后面我們站在巨人的肩膀上&#xff0c;繼續前行 一、Java 標準庫中的多線程框架 Execut…

Nodejs核心機制

文章目錄 前言 前言 結合 Node.js 的核心機制進行說明&#xff1a; 解釋事件循環的各個階段。 答案 Node.js 事件循環分為 6 個階段&#xff0c;按順序執行&#xff1a; Timers&#xff1a;執行 setTimeout 和 setInterval 的回調。 Pending I/O Callbacks&#xff1a;處理系…

C++筆記6:數字字面量后綴和前綴總結

在C中&#xff0c;可以在數字字面量后面添加字母后綴&#xff08;或前綴&#xff09;來表示特定的數據類型。這些后綴能夠明確指定字面量的類型&#xff0c;避免類型轉換帶來的潛在問題。以下是常見的幾種類型后綴及其含義&#xff1a; 1. 整數后綴 u 或 U&#xff1a;表示 u…

50.輻射抗擾RS和傳導抗擾CS測試環境和干擾特征分析

輻射抗擾RS和傳到抗擾CS測試環境和干擾特征分析 1. 輻射抗擾RS2. 傳導抗擾CS 1. 輻射抗擾RS 輻射抗擾RS考察對外界電磁場干擾得抗擾能力&#xff0c;測試頻段為80MHz~2000MHz&#xff0c;用1KHz得正弦波進行調幅&#xff0c;在電波暗室內進行。測試標準&#xff1a;IEC 61000-…

Java多態詳解

Java多態詳解 什么是多態&#xff1f; 比如我們說&#xff1a;“駕駛一輛車”&#xff0c;有人開的是自行車&#xff0c;有人開的是摩托車&#xff0c;有人開的是汽車。雖然我們都說“開車”&#xff0c;但“怎么開”是由具體的車類型決定的&#xff1a;“開”是統一的動作&a…

問題及解決01-面板無法隨著窗口的放大而放大

在MATLAB的App Designer中&#xff0c;默認情況下&#xff0c;組件的位置是固定的&#xff0c;不會隨著父容器的大小變化而改變。問題圖如下圖所示。 解決&#xff1a; 為了讓Panel面板能夠隨著UIFigure父容器一起縮放&#xff0c;需要使用布局管理器&#xff0c;我利用 MATLA…

【GESP真題解析】第 20 集 GESP 二級 2025 年 3 月編程題 2:時間跨越

大家好,我是莫小特。 這篇文章給大家分享 GESP 二級 2025 年 3 月編程題第 2 題:時間跨越。 題目鏈接 洛谷鏈接:B4260 時間跨越 一、完成輸入 根據題意,輸入包含五行,每行一個正整數,分別代表 y,m,d,h,k。 注意到數據范圍:對于全部數據,保證有 2000≤y≤3000,1≤m≤…

GTS-400 系列運動控制器板卡介紹(二十一)---電子齒輪跟隨

運動控制器函數庫的使用 運動控制器驅動程序、dll 文件、例程、Demo 等相關文件請通過固高科技官網下載,網 址為:www.googoltech.com.cn/pro_view-3.html 1 Windows 系統下動態鏈接庫的使用 在 Windows 系統下使用運動控制器,首先要安裝驅動程序。在安裝前需要提前下載運動…

軟件工程之需求分析涉及的圖與工具

需求分析與規格說明書是一項十分艱巨復雜的工作。用戶與分析員之間需要溝通的內容非常的多&#xff0c;在雙方交流信息的過程中很容易出現誤解或遺漏&#xff0c;也可能存在二義性。如何才能更加準確的表達雙方的意思&#xff0c;且清楚明了&#xff0c;繪制各類圖形就顯得非常…

藍橋杯14屆 數三角

問題描述 小明在二維坐標系中放置了 n 個點&#xff0c;他想在其中選出一個包含三個點的子集&#xff0c;這三個點能組成三角形。然而這樣的方案太多了&#xff0c;他決定只選擇那些可以組成等腰三角形的方案。請幫他計算出一共有多少種選法可以組成等腰三角形&#xff1f; 輸…

在Fiddler中添加自定義HTTP方法列并高亮顯示

在Fiddler中添加自定義HTTP方法列并高亮顯示 Fiddler 是一款強大的 Web 調試代理工具&#xff0c;允許開發者檢查和操作 HTTP 流量。一個常見需求是自定義 Web Sessions 列表&#xff0c;添加顯示 HTTP 方法&#xff08;GET、POST 等&#xff09;的列&#xff0c;并通過顏色區…

數據庫分庫分表實戰指南:從原理到落地

1. 為什么要分庫分表&#xff1f; 1.1 單庫瓶頸表現 存儲瓶頸&#xff1a;單表數據超過5000萬行&#xff0c;查詢性能急劇下降性能瓶頸&#xff1a;單庫QPS超過5000后響應延遲顯著增加可用性風險&#xff1a;單點故障導致全系統不可用 1.2 突破性優勢 --------------------…

Selenium的driver.get_url 和 手動輸入網址, 并點擊的操作,有什么不同?

我在搞爬取的時候&#xff0c;發現有些網站直接用driver.get(url) 跳轉到目標特定的網址的時候&#xff0c;會被強制跳轉到其他的網址上&#xff0c;但是如果是自己手動&#xff0c;在網址欄那里輸入網址&#xff0c;并點回車&#xff0c;卻能完成跳轉。 這是在使用 Selenium …

Java【06】數組查找(二分查找)、排序(冒泡排序、簡單選擇排序)

1. 數組的操作 1.1 數組的反轉 int[] arrs{3,5,7,8,9}; 編寫程序&#xff0c;讓arrs中的數據進行反轉{9,8,7,5,3} 1.2數組的查找 ① 順序查找 從頭到尾一個一個的找&#xff01; ② 二分查找 對數組有一個要求&#xff1a;數組必須是有序(大小)的&#xff01; int num3; int[]…

Redis 基礎詳解:從入門到精通

在當今互聯網應用開發領域&#xff0c;數據存儲與處理的性能和效率至關重要。Redis&#xff08;Remote Dictionary Server&#xff09;作為一款開源的、基于內存的鍵值存儲系統&#xff0c;憑借其出色的性能和豐富的功能&#xff0c;被廣泛應用于數據庫、緩存、消息中間件等場景…

圖片轉ICO圖標工具

圖片轉ICO圖標 可批量操作 下載地址&#xff1a; 鏈接&#xff1a;https://pan.quark.cn/s/6312c565ec98 這個工具是一個批量圖片轉ICO圖標的神器&#xff0c;有了它&#xff0c;以后再也不用為ICO格式的轉換煩惱&#xff01;而且這個軟件特別小巧&#xff0c;完全不用安裝。…

0基礎 | L298N電機驅動模塊 | 使用指南

引言 在嵌入式系統開發中&#xff0c;電機驅動是一個常見且重要的功能。L298N是一款高電壓、大電流電機驅動芯片&#xff0c;廣泛應用于各種電機控制場景&#xff0c;如直流電機的正反轉、調速&#xff0c;以及步進電機的驅動等。本文將詳細介紹如何使用51單片機來控制L298N電…

Flink 系列之十五 - 高級概念 - 窗口

之前做過數據平臺&#xff0c;對于實時數據采集&#xff0c;使用了Flink。現在想想&#xff0c;在數據開發平臺中&#xff0c;Flink的身影幾乎無處不在&#xff0c;由于之前是邊用邊學&#xff0c;總體有點混亂&#xff0c;借此空隙&#xff0c;整理一下Flink的內容&#xff0c…

大疆卓馭嵌入式面經及參考答案

FreeRTOS 有哪 5 種內存管理方式&#xff1f; heap_1.c&#xff1a;這種方式簡單地在編譯時分配一塊固定大小的內存&#xff0c;在整個運行期間不會進行內存的動態分配和釋放。它適用于那些對內存使用需求非常明確且固定&#xff0c;不需要動態分配內存的場景&#xff0c;優點是…