您好,欢迎来到凯特情感。
搜索
您的当前位置:首页[bootstrap]bootstrap2如何引导div垂直居中-CQ_LQJ

[bootstrap]bootstrap2如何引导div垂直居中-CQ_LQJ

来源:凯特情感


参考网址:http://www.4byte.cn/question/138712/bootstrap-how-to-center-vertical.html

部分参考自上面网页中的方法.用过bootstrap的同学知道,bootsrap2中可以使用栅格布局让div水平居中,那么如何让水平居中的div又垂直居中呢?

class="container">
class="row">
class="span4 offset4" style="padding:5 20 5 20;">
Some text text text text text .....


直接在css里面设置就可以实现居中,css代码:

/*web background*/
.container{
 display:table;
 height:100%; 
}

.row{
 display: table-cell;
 vertical-align: middle;
}

这样就实现了div的水平加垂直剧中了,完毕!

Copyright © 2019- ktwm.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务