1
是否可以垂直和水平居中放置導航欄?bootstrap導航欄中心垂直水平?
/**
* Logo.
*/
.button-logo {
font-family: 'Monoton', cursive;
font-weight:normal;
font-size:40px;
font-weight: 300;
line-height: 40px;
letter-spacing: 1px;
}
.button-logo:hover {
text-decoration: none;
}
.button-logo span {
display: block;
clear:both;
color: #000;
}
/**
* Centerise the logo.
*/
.navbar-header {
float: left;
text-align: center;
width: 100%;
}
.navbar-brand {
float:none;
}
/**
* Centerise the navbar.
*/
.navbar .navbar-nav {
display: inline-block;
float: none;
}
.navbar .navbar-collapse {
text-align: center;
}
/**
* Remove default background, radius, etc.
*/
.navbar {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
border: 0;
background: none;
box-shadow: none;
margin-bottom: 0;
}
.navbar-default .navbar-nav > li > a {
font-family: 'Monoton', cursive;
font-size: 25px;
letter-spacing: 2px;
color: #000;
color: rgba(0, 0, 0, 0.5);
padding-bottom: 0 !important;
}
.navbar-default .navbar-nav > li > a:hover {
color: #000;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
background: none;
background: none;
box-shadow: none;
color: #000;
}
<!-- Static navbar -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="offcanvas" data-target=".navmenu" data-canvas="body">
<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 button-logo" href="#">
<span>brand</span>
<span>brand</span>
<span>brand</span>
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<!-- menu-box -->
<div class="menu-box">
<ul class="nav navbar-nav">
<li class="active"><a href="home.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<!-- menu-box -->
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
但這只是居中導航欄水平不垂直。
任何想法?
你想要的品牌是在垂直和家庭有關,並在接觸水平 – Gowtham
@Gowtham我想要集中所有這些。 – laukok