【发布时间】:2019-12-05 01:03:07
【问题描述】:
下拉菜单将内容向下推送。
我已经尝试了所有我能找到的“修复”。相对位置、绝对位置、静态位置。但是有了这些,它仍然会向下推,虽然当动画结束时,下面的内容会向上跳跃一点(链接也在左侧/右侧)。
(Bootstrap 上是否还有其他菜单选项可以显示侧边栏?)
我查看了 Stackoverflow 上的所有问题。 相对于 ul 的位置,绝对的,静态的。也把所有的放在一个div里,试过Z-index。
@media (min-width: 576px), (max-width: 768px) {
.navbar {
padding-top: 3%;
padding-bottom: 1%;
display: flex;
justify-content: center;
}
.navbar-logo img {
width: 175px;
height: 21px;
}
.navbar-toggler {
border-style: none;
outline: none;
}
#menuCollapse {
width: 30px;
height: 22.5px;
outline: none;
}
.navbar-nav {
text-align: center;
font-family: Moon;
font-size: 18px;
letter-spacing: 2px;
margin-top: 10px;
}
.navbar-nav li {
padding-bottom: 10px;
}
.navbar-nav li a {
position: static;
}
.nav-link {
color: #ff6633;
}
ul {
position: absolute;
}
.h10 {
font-family: Moon;
font-weight: 500;
line-height: 35px;
color: #fff;
text-align: center;
margin-top: 6%;
font-size: 30px;
}
#chainB {
color: #58A9FF;
font-family: Equinox;
font-weight: 700;
}
.h50 {
font-family: Equinox;
font-weight: 400;
color: #fff;
margin-top: 7%;
text-align: center;
font-size: 14px;
letter-spacing: 1px;
}
.getChain {
text-align: center;
margin-top: 7%;
}
#getChainBtn {
background-color: #FF6633;
border: none;
color: #fff;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 15px;
border-radius: 25px;
font-family: Moon;
font-weight: 700;
}
.imageLogos {
display: flex;
justify-content: center;
}
.imageLogos img {
width: 30px;
height: 35px;
margin-top: 3%;
}
}
<nav class="navbar navbar-expand-md navbar-light sticky-top">
<div class="container-fluid">
<a class="navbar-logo" href="Homepage.html"><img id="Logo" src="./Logo/Logo.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" style="outline: none;">
<img src="./Menu/menu.png" id="menuCollapse">
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#" style= "color: #ff6633;">ABOUT US</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style= "color: #ff6633;">FEATURES</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style= "color: #ff6633;">PRICING</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style= "color: #ff6633;">CONTACT US</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style= "color: #ff6633;">LOGIN</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style= "color: #ff6633;" >SIGN UP</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="h10">
Privacy, security <br /> and freedom by the <span id="chainB">CHAIN.</span>
</div>
<div class="h50">
Completely decentralized, P2P, Swift VPN built on Blockchain
</div>
<div class="getChain">
<button type="button" id="getChainBtn">
Get ChainVPN Now!
</button>
<div class="imageLogos">
<img src="./Platforms/Windows.png" alt="Windows" style="margin-right: 20px;">
<img src="./Platforms/Apple.png" alt="Apple" style="margin-right: 20px;">
<img src="./Platforms/Android.png" alt="Android" style="margin-right: 20px;">
<img src="./Platforms/Linux.png" alt="Linux" id="Linux">
</div>
</div>
【问题讨论】:
-
请添加 JSFiddle 或 Codepen 链接。阅读本文的人会更容易调试。
-
如果您添加您预期的输出图像会更好。
-
该设计适用于手机(而非台式机)。
-
您想在移动端视图的左侧显示关于我们、功能、价格的信息吗?