Bootstrap 4 多媒体对象 多媒体对象图片显示在右边
如果你想将头像图片显示在右侧,可以在 .media-body 容器后添加图片:
实例:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap4 实例</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" >
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
<script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
</head>
<body>
<div class="container mt-3">
<h2>图片显示在右边</h2>
<p>如果你想将头像图片显示在右侧,可以在 .media-body 容器后添加图片:</p>
<div class="media border p-3">
<div class="media-body">
<h4>bootstrap4教程</h4>
<p>Bootstrap4 目前是 Bootstrap 的最新版本,是一套用于 HTML、CSS 和 JS 开发的开源工具集。</p>
</div>
<img src="https://www.w3cschool.cn/attachments/cover/cover_bootstrap4.jpg" alt="John Doe" class="ml-3 mt-3 rounded-circle" style="width:60px;">
</div>
</div>
</body>
</html>
尝试一下 |