gpt4 book ai didi

html - 响应式导航栏元素

转载 作者:行者123 更新时间:2023-11-28 04:47:21 26 4
gpt4 key购买 nike

我正在使用 Bootstrap 3 创建导航栏。我的导航栏在元素和中间的 Logo 之间有一定的间距。每次放大时,元素和 Logo 之间的间距都会减小。放大/缩小时如何使间距保持不变?

100%: enter image description here175%: enter image description here

如果需要,这是我的 CSS + HTML,

.navbar-default {
height: 125px;
background-color: transparent;
border-color: transparent;
}

.navbar-brand {
transform: translateX(-50%);
left: 50%;
position: absolute;
}

.navbar-brand img {
height: 95px;
}

.navbar-nav li a {
line-height: 125px;
height: 125px;
padding-top: 0;
font-weight: 300;
text-transform: uppercase;
}

.navbar-default .navbar-nav>li>a {
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}

.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a {
background-color: transparent !IMPORTANT;
}

.navbar-default .navbar-nav>li>a:hover {
color: #1AC1AD !IMPORTANT;
}

<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="#"><img src="assets/img/logo-plain.png"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li><a href="#">Home</a></li>
<li><a href="#">Portfolio</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</nav>

最佳答案

@media (min-width: 768px) {
.container {
width: 100%;
}
}

关于html - 响应式导航栏元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40878085/

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