![fe1a1f3b6f9945cdfe5b7d3dbb0dbe1c.png](https://i-blog.csdnimg.cn/blog_migrate/e3a5661b222a696b8ec454e8117f19c9.jpeg)
如果你需要显示的内容区包括了一个图片和一个可选的标题,可使用.figure
样式定义。
Bootstrap的.figure
以及.figure-caption
类,为HTML5的<figure>
以及<figcaption>
元素提供了一个基准样式处理。默念认的图片系统不会定义明确的大小,因此请务必将该.img-fluid类添加到您的<img>
标签中才能实现与响应式的完美结合。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title></title>
</head>
<body>
<div class="container">
<div class="row">
<figure class="figure">
<img src="images/1140.jpg" class="img-fluid rounded figure-img" alt="">
<figcaption class="figure-caption text-center">一叶知秋</figcaption>
</figure>
</div>
</div>
</body>
</html>
![53f3437753a796d36ffb1174c495216c.png](https://i-blog.csdnimg.cn/blog_migrate/b1fbceb3785f1942e04cd2729669c8ff.jpeg)
标题对齐可以使用:右对齐.text-right、左对齐 .text-left、居中对齐 .text-center。