twitter-bootstrap 在引导程序上居中 .col-md-x
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19916798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Centering .col-md-x on bootstrap
提问by Zoker
How could I center the .col-md-8 (http://getbootstrap.com/css/#grid-example-basic) on bootstrap valid html?
我怎样才能将 .col-md-8 ( http://getbootstrap.com/css/#grid-example-basic) 放在引导有效的 html 上?
回答by zach57
You can use the class col-md-offset-2. Or you can create a div inside of your column div and use a class of content-center. Hope this helps.
您可以使用 col-md-offset-2 类。或者您可以在列 div 内创建一个 div 并使用一类内容中心。希望这可以帮助。
回答by Burak Karaku?
What I did was a little bit of hacky, but it works:
我所做的有点笨拙,但它有效:
Just use col-md-2divs before and after your main col-md-8div.
只需col-md-2div在 main 之前和之后使用s col-md-8div。
回答by Rakesh Vadnal
Just add the class .row-centered to the row and .col-centered to the columns.
只需将 .row-center 类添加到行中,将 .col-center 类添加到列中。
<div class="container">
<div class="row row-centered">
<div class="col-md-8 col-centered"></div>
</div>
</div>
CSS
CSS
.row-centered {text-align:center;}
.col-centered { display:inline-block; float:none; margin-right:-4px;}

