CQ-LQJ

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

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

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

</div>

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

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

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

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

分类:

技术点:

相关文章:

  • 2021-05-17
  • 2021-10-16
  • 2021-09-02
  • 2022-12-23
  • 2022-01-05
  • 2021-12-29
  • 2021-12-24
  • 2022-02-10
猜你喜欢
  • 2021-11-13
  • 2021-12-13
  • 2022-01-09
相关资源
相似解决方案