【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.mzph.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;优点是…