0
我一直在我的頭撞在桌子上現在一會兒在這個。我猜測有一個簡單的解決方案或黑客,我錯過了。我已經嘗試調整鏈接的填充和邊距,李和他們周圍的容器。我希望它們在導航欄中保持垂直居中,而不管屏幕大小。現在,當視口大小調整時,它們會上下移動。我的代碼如下:麻煩垂直居中鏈接響應自助增加navbar
/* Style for Navbar/Header */
nav.navbar {
padding: 0 1% 0 1%;
}
.navbar,
.dropdown-menu {
background-image: url(../images/[email protected]);
}
.navbar .navbar-nav > li > a:hover,
.navbar .navbar-nav > li > a:focus,
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #656864 !important;
color: white;
}
ul.nav.navbar-nav.navbar-right.collapse.navbar-collapse {
background: red;
margin-top: 5%;
}
.navbar .navbar-nav > li > a {
font-family: "bodoni mt condensed", serif;
font-size: 3.6vw;
color: #a5a7a4;
padding-top: 60px;
padding-bottom: 60px;
}
.dropdown-menu > li > a {
line-height: 100%;
font-family: "bodoni mt condensed", serif;
font-size: 2.5vw;
color: #a5a7a4;
}
.links-container {
}
#logo-bar {
width: 100%;
}
.navbar-toggle {
background-color: #a5a7a4;
position: static;
padding: 2%;
margin-top: 61px;
margin-right: 40px;
margin-bottom: 0;
}
div.navbar-header.nav.navbar-nav {
}
.icon-bar {
background-color: white;
}
/* End of navbar style */
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-static-top">
<div class="container-fluid">
<div class="navbar-header col-sm-4">
<a class="" href="index.html"><img id="logo-bar" class='col-sm-4' src="images/logo-bar.svg" alt="Arrow's Edge Design Logo"></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="links-container">
<ul class="nav navbar-nav navbar-right collapse navbar-collapse">
<li><a href="index.html" class="option">Home</a></li>
<li><a href="our-services.html" class="option">Our Services</a></li>
<li><a href="#" class="option" data-toggle="dropdown">About Us<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="blog.html">Blog</a></li>
<li><a href="our-work.html">Our Work</a></li>
<li class="divider"></li>
<li><a href="https://www.facebook.com/arrowsedgedesign/">Facebook</a></li>
</ul>
</li>
<li><a href="contact-us.php" class="option">Contact Us</a></li>
</ul>
</div>
</div>
</nav>
<!-- end of HTML for navbar -->
有沒有辦法做到這一點,以便它可以跨所有視口工作,而不必創建一堆媒體查詢? –