BootStrap Div居中
来源:互联网 发布:微信群自动群发软件 编辑:程序博客网 时间:2024/05/22 10:21
使用BootStrap,如果一个Div只占用了一小部分,怎么居中呢?
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><title>BootStrap3.3.2测试</title><link href="../bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><script src="../Jquery/jquery-1.11.2.min.js"></script><script src="../bootstrap/3.3.2/js/bootstrap.min.js"></script><style>.col-center-block { float: none; display: block; margin-left: auto; margin-right: auto;}</style></head><body><div class="container"> <div class="row myCenter"> <div class="col-xs-6 col-md-4 col-center-block"> <form class="form-signin"> <h2 class="form-signin-heading">请登录</h2> <label for="username" class="sr-only">用户名</label> <input type="text" id="username" class="form-control" placeholder="用户名" required autofocus> <label for="inputPassword" class="sr-only">密码</label> <input type="password" id="inputPassword" class="form-control" placeholder="密码" required> <div class="checkbox"> <label> <input type="checkbox" value="remember-me"> 记住我 </label> </div> <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button> </form> </div> </div></div></body></html>给Div添加这样一个Style就可以实现:
<style>.col-center-block { float: none; display: block; margin-left: auto; margin-right: auto;}</style>最终效果如下:
0 3
- BootStrap Div居中
- BootStrap Div居中
- bootstrap div 居中
- bootstrap的大型居中div
- 使用BootStrap,Div一小部分的居中方法.
- bootstrap 居中
- div 居中
- DIV 居中
- div 居中
- div居中
- div居中
- div居中
- div居中
- Div居中
- Div居中
- div 居中
- DIV居中
- div居中
- 如何解决App无法收到android开机广播
- 第19周项目2 猴子选大王
- Overview Screen
- 黑马程序员--Java基础--字符串常用操作(一)
- 面试题之七
- BootStrap Div居中
- Android导航图
- 协方差
- KeyValuePair和Dictionary
- Java压力测试
- Android 解决魅族手机豌豆荚能连上,Eclipse不能识别的问题
- HTML在移动端页面设计是touch事件注意事项
- 补码
- Activity和Fragment的五种交互方式(Activity可以改变Fragment的UI,Fragment也可以改变ActivityUI)