Skip to main content Skip to docs navigation

图形

在 Bootstrap 中使用图形组件显示相关图片和文本的文档和示例。

目录

每当你需要显示一段内容(例如带有可选标题的图片)时,请考虑使用 <figure>

¥Anytime you need to display a piece of content—like an image with an optional caption, consider using a <figure>.

使用包含的 .figure.figure-img.figure-caption 类为 HTML5 <figure><figcaption> 元素提供一些基线样式。图中的图片没有明确的尺寸,因此请务必将 .img-fluid 类添加到 <img> 中以使其响应。

¥Use the included .figure, .figure-img and .figure-caption classes to provide some baseline styles for the HTML5 <figure> and <figcaption> elements. Images in figures have no explicit size, so be sure to add the .img-fluid class to your <img> to make it responsive.

Placeholder400x300
A caption for the above image.
html
<figure class="figure">
  <img src="..." class="figure-img img-fluid rounded" alt="...">
  <figcaption class="figure-caption">A caption for the above image.</figcaption>
</figure>

使用我们的文本实用程序 可以轻松对齐图形的标题。

¥Aligning the figure’s caption is easy with our text utilities.

Placeholder400x300
A caption for the above image.
html
<figure class="figure">
  <img src="..." class="figure-img img-fluid rounded" alt="...">
  <figcaption class="figure-caption text-end">A caption for the above image.</figcaption>
</figure>

CSS

Sass 变量

¥Sass variables

$figure-caption-font-size:          $small-font-size;
$figure-caption-color:              var(--#{$prefix}secondary-color);