Bootstrap4 卡片

2020-06-19 08:31:35易采站长站整理

Bootstrap4 卡片
简单的卡片

我们可以通过 Bootstrap4 的 .card 与 .card-body 类来创建一个简单的卡片,实例如下:

实例

简单的卡片

Bootstrap4 的卡片类似 Bootstrap 3 中的面板、图片缩略图、well。


头部和底部

.card-header类用于创建卡片的头部样式, .card-footer 类用于创建卡片的底部样式:

实例

头部内容底部


多种颜色卡片

Bootstrap 4 提供了多种卡片的背景颜色类: .bg-primary,
.bg-success, .bg-info, .bg-warning, .bg-danger, .bg-secondary, .bg-dark 和 .bg-light。

实例

多种颜色卡片

Basic card

Primary card

Success card

Info card

Warning card

Danger card

Secondary card

Dark card

Light card


标题、文本和链接

我们可以在头部元素上使用 .card-title 类来设置卡片的标题 。
.card-text 类用于设置卡片正文的内容。 .card-link 类用于给链接设置颜色。

实例

Card title

Some example text. Some example text.

Card link
Another link


图片卡片

我们可以给
添加 .card-img-top(图片在文字上方) 或 .card-img-bottom(图片在文字下方 来设置图片卡片:

实例

Card image

John Doe

Some example text.

See Profile

如果图片要设置为背景,可以使用 .card-img-overlay 类:

实例

Card image

John Doe

Some example text.

See Profile

相关文章 大家在看