【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>
页面展示效果:
相关文章:

【Bootstrap V4系列】学习入门教程之 组件-媒体对象(Media object)
Bootstrap V4系列 学习入门教程之 组件-媒体对象(Media object) 媒体对象(Media object)一、Example二、Nesting 嵌套三、Alignment 对齐四、Order 顺序五、Media list 媒体列表 媒体对象(Media object) B…...
ALSTOM D-984-0721 自动化组件
ALSTOM D-984-0721是一款高性能自动化组件,专为电力行业、石化行业和一般自动化应用的苛刻环境而设计。该型号旨在提供卓越的可靠性和精度,因其强大的输入/输出能力、耐用性和无缝集成能力而脱颖而出,成为现代工业自动化系统不可或缺的工具。…...

2025数字中国创新大赛-数字安全赛道数据安全产业积分争夺赛决赛Writeup
文章目录 综合场景赛-模型环境安全-3综合场景赛-数据识别与审计-1综合场景赛-数据识别与审计-2综合场景赛-数据识别与审计-3 有需要题目附件的师傅,可以联系我发送 综合场景赛-模型环境安全-3 upload文件嵌套了多个png图片字节数据,使用foremost直接分离…...

无法更新Google Chrome的解决问题
解决问题:原文链接:【百分百成功】Window 10 Google Chrome无法启动更新检查(错误代码为1:0x80004005) google谷歌chrome浏览器无法更新Chrome无法更新至最新版本? 下载了 就是更新Google Chrome了...

数字孪生市场格局生变:中国2025年规模214亿,工业制造领域占比超40%
一、技术深度解析:数字孪生的核心技术栈与演进 1. 从镜像到自治:数字孪生技术架构跃迁 三维重建突破:LiDAR点云精度达2cm,无人机测深刷新频率5Hz,支撑杭州城市大脑内涝预警模型提前6小时预测。AI算法融合:…...
ES6 (ECMAScript 2015) 详解
文章目录 一、ES6简介1.1 什么是ES6?1.2 为什么要学习ES6?1.3 浏览器支持情况 二、let和const关键字2.1 let关键字2.2 const关键字2.3 var、let和const的选择 三、箭头函数3.1 基本语法3.2 箭头函数的特点3.3 何时使用箭头函数 四、模板字符串4.1 基本语…...

全球首款无限时长电影生成模型SkyReels-V2本地部署教程:视频时长无限制!
一、简介 SkyReels-V2 模型集成了多模态大语言模型(MLLM)、多阶段预训练、强化学习以及创新的扩散强迫(Diffusion-forcing)框架,实现了在提示词遵循、视觉质量、运动动态以及视频时长等方面的全面突破。通过扩散强迫框…...
SQL 数据库监控:SQL语句监控工具与实践案例
SQL 数据库监控:SQL语句监控工具与实践案例 SQL语句监控的主要方法 SQL监控主要通过以下几种方式实现: 数据库内置监控功能:大多数数据库系统提供内置的SQL监控工具数据库性能视图/系统表:通过查询特定的系统视图获取SQL执行信…...
AB测试面试题
AB测试面试题 常考AB测试问答题(1)AB测试的优缺点是什么?(2)AB测试的一般流程/介绍一下日常工作中你是如何做A/B实验的?(3)第一类错误 vs 第二类错误 vs 你怎么理解AB测试中的第一、二类错误?(4)统计显著=实际显著?(5)AB测试效果统计上不显著?(6)实验组优于对…...

颠覆性技术革命:CAD DWG图形瓦片化实战指南
摘要 CAD DWG图形瓦片化技术通过金字塔模型构建多分辨率地图体系,实现海量工程图纸的Web高效可视化。本文系统解析栅格瓦片与矢量瓦片的技术原理,详细对比两者在生成效率、样式自由度和客户端性能等维度的差异,并结合工程建设、工业设计和智…...

不换设备秒通信,PROFINET转Ethercat网关混合生产线集成配置详解
在汽车制造中,连接Profinet控制的PLC(如西门子S7)与EtherCAT伺服驱动器(如倍福AX5000),实现运动控制同步。 在汽车制造的混合生产线集成中,实现西门子S7 PLC与倍福AX5000 EtherCAT伺服驱动器的…...

c++STL-string的使用
这里写自定义目录标题 string的使用string写成类模板的原因string的版本举例构造、析构函数和赋值重载构造函数和析构函数operator Iterators迭代器begin和endrbegin和rendcbegin和cend,crbegin和crend(c11) capacity容量有关函数不同编译器下…...

UNet网络 图像分割模型学习
UNet 由Ronneberger等人于2015年提出,专门针对医学图像分割任务,解决了早期卷积网络在小样本数据下的效率问题和细节丢失难题。 一 核心创新 1.1对称编码器-解码器结构 实现上下文信息与高分辨率细节的双向融合 如图所示:编码器进行了4步&…...

使用 SHAP 进行特征交互检测:揭示变量之间的复杂依赖关系
我们将探讨如何使用 SHAP(SHapley 加法解释)来检测和可视化机器学习模型中的特征交互。了解特征组合如何影响模型预测对于构建更透明、更准确的模型至关重要。SHAP 有助于揭示这些复杂的依赖关系,并使从业者能够以更有意义的方式解释模型决策…...

Python-MCPInspector调试
Python-MCPInspector调试 使用FastMCP开发MCPServer,熟悉【McpServer编码过程】【MCPInspector调试方法】-> 可以这样理解:只编写一个McpServer,然后使用MCPInspector作为McpClient进行McpServer的调试 1-核心知识点 1-熟悉【McpServer编…...

Java设计模式-策略模式(行为型)
策略模式详解 一、策略模式概述 1.1 基本概念 策略模式是一种行为型设计模式,它主要用于处理算法的不同变体。其核心思想是将算法的定义与使用分离开来,把一系列具体的算法封装成独立的策略类,这些策略类实现相同的策略接口。客户端可以在…...

html body 设置heigth 100%,body内元素设置margin-top出滚动条(margin 重叠问题)
今天在用移动端的时候发现个问题,html,body 设置 height:100% 会出现纵向滚动条 <!DOCTYPE html> <html> <head> <title>html5</title> <style> html, body {height: 100%; } * {margin: 0;padding: 0; } </sty…...

C语言模糊不清的知识
1、malloc、calloc、realloc的区别和用法 malloc实在堆上申请一段连续指定大小的内存区域,并以void*进行返回,不会初始化内存。calloc与malloc作用一致,只是calloc会初始化内存,自动将内存清零。realloc用于重新分配之前通过mallo…...

如何配置光猫+路由器实现外网IP访问内部网络?
文章目录 前言一、网络拓扑理解二、准备工作三、光猫配置3.1 光猫工作模式3.2 光猫端口转发配置(路由模式时) 四、路由器配置4.1 路由器WAN口配置4.2 端口转发配置4.3 动态DNS配置(可选) 五、防火墙设置六、测试配置七、安全注意事…...

springboot3+vue3融合项目实战-大事件文章管理系统获取用户详细信息-ThreadLocal优化
一句话本质 为每个线程创建独立的变量副本,实现多线程环境下数据的安全隔离(线程操作自己的副本,互不影响)。 关键解读: 核心机制 • 同一个 ThreadLocal 对象(如示意图中的红色区域 tl)被多个线…...

【高数上册笔记篇02】:数列与函数极限
【参考资料】 同济大学《高等数学》教材樊顺厚老师B站《高等数学精讲》系列课程 (注:本笔记为个人数学复习资料,旨在通过系统化整理替代厚重教材,便于随时查阅与巩固知识要点) 仅用于个人数学复习,因为课…...

c++STL-string的模拟实现
cSTL-string的模拟实现 string的模拟实现string的模拟线性表的实现构造函数析构函数获取长度(size)和获取容量(capacity)访问 [] 和c_str迭代器(iterator)交换swap拷贝构造函数赋值重载(&#x…...

YashanDB(崖山数据库)V23.4 LTS 正式发布
2024年回顾 2024年11月我们受邀去深圳参与了2024国产数据库创新生态大会。在大会上崖山官方发布了23.3。这个也是和Oracle一样采用的事编年体命名。 那次大会官方希望我们这些在一直从事在一线的KOL帮助产品提一些改进建议。对于这样的想法,我们都是非常乐于合作…...

python 写一个工作 简单 番茄钟
1、图 2、需求 番茄钟(Pomodoro Technique)是一种时间管理方法,由弗朗西斯科西里洛(Francesco Cirillo)在 20 世纪 80 年代创立。“Pomodoro”在意大利语中意为“番茄”,这个名字来源于西里洛最初使用的一个…...
C++.IP协议通信
C++IP协议通信 1. TCP协议通信1.1 服务端实现创建套接字绑定地址监听连接接受连接数据传输关闭连接1.2 客户端实现创建套接字连接服务器数据传输关闭连接1.3 示例代码服务端代码示例客户端代码示例绑定地址接收数据发送数据关闭套接字2.2 客户端实现创建套接字发送数据接收数据…...
css背景相关
背景书写 background: url(src); // 注意:在写动态样式时,backgournd赋值格式错误,是不会在浏览器dom的style上显示的 // 但是可以创建不可见的img,预加载来提高性能背景也会加载图片资源 同img的src一样,background也…...

PyCharm 加载不了 conda 虚拟环境,不存在的
#工作记录 前言 在开发过程中,PyCharm 无法加载 Conda 虚拟环境是常见问题。 在不同情况下,“Conda 可执行文件路径”的指定可能会发生变化,不会一尘不变,需要灵活处置。 以下是一系列解决此问题的经验参考。 检查 Conda 安装…...

设计模式学习整理
目录 UML类图 设计模式六大原则 1.单一职责原则 2.里氏替换原则 3.依赖倒置原则 4.接口隔离原则 5.迪米特法则(最少知道原则) 6.开(放封)闭原则 设计模式分类 1.创建型模式 2.结构型模式 4.行为型模式 一、工厂模式(factory——简单工厂模式和抽象工厂模式) 1.1、…...

二分查找的理解
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h>int binary_search(int arr[], int k, int sz) {int left 0;int right sz - 1;//这个是下标,减一是因为在0开始的,怕越界(访问无效)while (left < right){int mid…...

【Java】线程实例化 线程状态 线程属性
线程实例化 继承 Thread 类 创建类继承自 Thread 类 . class MyThread extends Thread重写 run() 方法 . Overridepublic void run(){// 线程要执行的任务代码}实例化自定义线程类 . 实现 Runnable 接口 创建类实现 Runnable 接口 . class MyRunnable implements Runnable实…...