Bootstrap3中的navbar里的navbar-brand元素如何控制可以居中而不是缺省的靠左 ,?代碼如下: - <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="#">Brand</a>
- </div>
生成效果:
求個方法可以更好的修改navbar-brand,,讓它居中而不是靠左,?
我是這么處理的: CSS - @media (max-width: 768px){
- .navbar-header {
- text-align: center;
- width: 100%;
- }
- .navbar-brand {
- float:none;
- display:inline-block;
- margin-left: auto;
- margin-right: auto;
- margin-top: 0;
- }
- }
|