Bootstrap 元素居中设置


一、Bootstrap水平居中

1、 文本:class ="text-center"

2、 图片居中:class = "center-block"

3、其他元素:

 bootstrap3水平居中:利用bootstrap列偏移  class = "col-md-offset-4 col-lg-offset-4col-xl-offset-4"
 bootstrap4水平居中:class = "m-auto"
 

二、Bootstrap垂直居中

bootstrap3 如何让div内部垂直居中:

Bootstrap的栅格系统使用的是float:left的浮动方式,vertical-align属性不起作用,故把内部div的float属性清除,添加display属性,如下:

.middle {
float: none;
display: inline-block;
vertical-align: middle;
}

 

Bootstrap3登录框自适应水平居中+垂直居中

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM