如何将图像置于Bootstrap中心? [英] How do I center an image in Bootstrap?
本文介绍了如何将图像置于Bootstrap中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎没有以任何方式工作,我尝试过在Bootstrap 4 Alpha 6的旋转木马中将图像水平居中。 ,包括使用 center-block
。
以下是我迄今为止所尝试的:
I'm trying to horizontally center an image in the carousel of Bootstrap 4 Alpha 6.
It doesn't seem to work in any way I've tried, including using center-block
.
Here's what I've tried so far: http://codepen.io/anon/pen/wJdjQg?editors=1100
Any hints?
解决方案
center-block
has been replaced by mx-auto
in Bootstrap 4. mx-auto
represents auto x-axis margins (margin=left: auto; margin-right: auto) so it
can be used to center display:block
or display:flex
elements.
<div class="carousel-item active">
<img class="img-fluid mx-auto" src="https://unsplash.it/200/200" alt="First slide">
</div>
More on Centering in Bootstrap 4
这篇关于如何将图像置于Bootstrap中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文