【发布时间】:2019-05-31 18:33:18
【问题描述】:
只是为了在标记为转帖之前说清楚, 这一切都不起作用: How to center cards in bootstrap 4? How to align an image dead center with bootstrap Centering the image in Bootstrap How can I center an image in Bootstrap? How do I center an image in Bootstrap? How to align a <div> to the middle (horizontally/width) of the page How to horizontally center a <div>?
话虽如此,我的问题很简单,我有两个 div,背景 div 和 bootstrap 中的卡片 div。 mx-auto 将垂直居中很好,但无法从卡顶部解开。这样我在卡的上方和下方也有空间。我已经尝试了所有 m 和 p 类。以及自定义类。有人可以帮我吗。我希望我的卡片位于屏幕中间。
<div class="bg">
<div class="card card-design success-design mx-auto">
<div class="card-body">
现在看起来像这样:
ooooxxxoooo
ooooxxxoooo
ooooooooooo
ooooooooooo
我想要:
ooooooooooo
ooooxxxoooo
ooooxxxoooo
ooooooooooo
【问题讨论】:
-
你的“图像”表明你想垂直居中,但你说的是“水平”。
-
嗯,这是语言的极限,我想了想,似乎两者都可以同时为真
标签: html css twitter-bootstrap