gpt4 book ai didi

html - Bootstrap - 如何将其中有文本的 div 居中?

转载 作者:太空宇宙 更新时间:2023-11-03 21:35:55 26 4
gpt4 key购买 nike

我希望能够将包含以下文本的 div 置于页面中间。我虽然可以在 Bootstrap 中使用“center-block”类,但它似乎不起作用:

实时预览: http://codepen.io/anon/pen/tCIlG

Code below:

<div class="row">
<div class="col-md-4 center-block text-center">

I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.I want to center the div that this text is in.

</div>
</div>

最佳答案

.col-md-4 类导致它向左浮动而不是居中。如果你想保持那个类的宽度,你可以在 CSS 中覆盖它:

.col-md-4.center-block {
float: none;
}

更新代码笔:http://codepen.io/sdsanders/pen/lHrvu

关于html - Bootstrap - 如何将其中有文本的 div 居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26664498/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com