gpt4 book ai didi

jquery - 如何使我的元素在我的导航栏中流畅

转载 作者:行者123 更新时间:2023-11-28 17:28:35 25 4
gpt4 key购买 nike

我正在制作一个包含 5 个元素的导航栏:4 个文本链接和 1 个 Logo 链接。所有 5 个元素都居中并且需要一个边距。当窗口变小时,边距也必须变小。

我想实现网格系统,但我似乎没有让它工作..

这是 JSFiddle:http://jsfiddle.net/bg9ubxq1/1/

HTML:

<nav id="menuTemp" class="navbar navbar-static-top text-center" role="navigation">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">
<img src="content/images/logos/logo_mini.png" alt="logo" class="animated visible-xs visible-sm" />
</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav custom-navbar">
<li><a href="#">Diensten</a></li>
<li><a href="#">Technologie&euml;n</a></li>
<li class="visible-md visible-lg">
<img src="content/images/logos/logo_mini.png" alt="logo" class="animated center-block" />
</li>
<li><a href="#">Vacatures</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>

CSS:

.navbar-static-top .navbar-toggle .icon-bar {
background-color: #888;
}
@media (min-width:768px) {
.custom-navbar {
margin: 5px auto;
display: table;
table-layout: fixed;
float: none;
height: 51px;
}
}
#menuTemp {
box-shadow: 0px 5px 10px #ddd;
z-index: 1000;
height: 58px;
}
.nav {
margin-top: 3px;
}
.nav > li {
/*margin: 0 60px;*/
margin: 0 20px;
}
.nav > li > a:hover {
background-color: #F5F7FA;
}
.nav > li > a:focus {
background-color: white;
outline: none;
}
.navbar-nav > li > img {
position: relative;
bottom: 1px;
}

最佳答案

我一分钟前自己弄明白了。只需应用一些媒体查询并进行一些像素精度调整。

当然我还需要修复折叠功能,但这应该不会太难!

JSFiddle:http://jsfiddle.net/ephy55bo/

HTML:

<nav id="menuTemp" class="navbar navbar-static-top text-center" role="navigation">
<div class="container">
<div class="navbar-header"> <a href="#" class="navbar-brand">
<img src="http://www.allphi.eu/content/images/logos/logo_mini.png" height="41" width="41" alt="AllPhi logo" class="animated hide" />
</a>

<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse"> <span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>

</button>
</div>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav custom-navbar">
<li><a href="#">Diensten</a>

</li>
<li><a href="#">Technologie&euml;n</a>

</li>
<li id="crop-fix">
<img src="http://www.allphi.eu/content/images/logos/logo_mini.png" alt="AllPhi logo" class="animated center-block" />
</li>
<li><a href="#">Vacatures</a>

</li>
<li><a href="#contact" data-toggle="modal">Contact</a>

</li>
</ul>
</div>
</div>
</nav>

CSS:

body {
font-family:"Segoe UI", "Arial", sans-serif;
font-size: 15px;
color: #9d9d9c;
height: 100%;
width: auto !important;
padding: 0px;
margin: 0px;
background-color: white;
-webkit-transition: all 1s linear;
-moz-transition: all 1s linear;
-o-transition: all 1s linear;
transition: all 1s linear;
-webkit-transform: translateZ(0);
/*smooth translation in mobile*/
-webkit-font-smoothing: antialiased;
/*-webkit-font-smoothing:none;*/
}
a {
color: #9d9d9c;
font-weight: bold;
text-transform: uppercase;
}
a:hover, a:focus {
color: #2394d5;
}
.navbar-static-top .navbar-toggle .icon-bar {
background-color: #888;
}
@media (min-width:768px) {
.custom-navbar {
margin: 5px auto;
display: table;
table-layout: fixed;
float: none;
height: 51px;
}
}
#menuTemp {
box-shadow: 0px 5px 10px #ddd;
z-index: 1000;
height: 58px;
}
.nav {
margin-top: 3px;
}
.nav > li {
width: 222px;
}
.nav > li > a:hover {
background-color: #F5F7FA;
}
.nav > li > a:focus {
background-color: white;
outline: none;
}
.navbar-nav > li > img {
position: relative;
bottom: 1px;
}
@media (min-width: 1200px) {
.nav > li {
width: 222px;
}
}
@media (min-width: 1100px) and (max-width:1199px) {
.nav > li {
width: 170px;
}
}
@media (min-width: 992px) and (max-width: 1099px) {
.nav > li {
width: 152px;
}
}
@media (min-width: 768px) and (max-width: 992px) {
.nav > li#crop-fix {
width: 95px;
left: 8px;
}
.nav > li {
width: 152px;
}
}

关于jquery - 如何使我的元素在我的导航栏中流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26630306/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com