如何在引导程序 4 中居中卡片? [英] How to center cards in bootstrap 4?

查看:23
本文介绍了如何在引导程序 4 中居中卡片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 bootstrap 4 alpha 3.
我想将卡片水平居中放置在页面中间.

I am using bootstrap 4 alpha 3.
I want to center the card horizontally in the middle across the page.

预览/链接: http://codepen.io/vaibhavsingh97/full/VjRAXW

我已经尝试了 bootstrap 4 示例页面上列出的所有不同选项卡.

I have tried all the different options listed on the bootstrap 4 example page for cards.

我怎样才能做到这一点?

How can I achieve this?

推荐答案

为 .card 添加 css

Add the css for .card

.card {
        margin: 0 auto; /* Added */
        float: none; /* Added */
        margin-bottom: 10px; /* Added */
}

这是

更新:您可以使用 bootstrap 4 中提供的 .mx-auto 类来居中卡片.

UPDATE: You can use the class .mx-auto available in bootstrap 4 to center cards.

这篇关于如何在引导程序 4 中居中卡片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆