我正在尝试重新安排我使用Bootstrap 4制作的折叠导航栏。它现在看起来像这样:
有没有办法将社交媒体按钮对齐在一条线上,然后带上'关于'进一步向下并摆脱“项目”前面的空间。和'联系'?
到目前为止我的代码:
<nav class="navbar navbar-fixed-top navbar-light bg-faded">
<button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
☰
</button>
<div class="collapse navbar-toggleable-xs" id="exCollapsingNavbar2">
<a class="navbar-brand" href="#">Timo Springer</a>
<ul class="nav navbar-nav m-x-auto" style="width: 300px;">
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#projects">Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
<ul class="nav navbar-nav pull-md-right">
<li class="nav-item">
<a class="nav-link" href="https://www.facebook.com/timo.springer"><i class="fa fa-facebook" aria-hidden="true"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.instagram.com/springertimo/?hl=en"><i class="fa fa-instagram" aria-hidden="true"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://500px.com/timospringer"><i class="fa fa-500px" aria-hidden="true"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://de.linkedin.com/in/timo-springer-372468129"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
</li>
</ul>
</div>
非常感谢!
蒂莫
答案 0 :(得分:0)
只需在媒体广告管理系统的导航标记中添加clear:both
@media (max-width:767px){
.nav.m-x-auto{
clear:both;
margin: 0 !important;
}
.nav.navbar-nav.pull-md-right li{
float:left;
}
.nav.navbar-nav.pull-md-right li + li{
margin-left: 1rem;
}
}
这是Demo
答案 1 :(得分:0)
我认为以下内容应该有效。
ul.nav.navbar-nav.m-x-auto {
float: none!important;
clear: both!important;
width: 100%!important;
}
ul.nav.navbar-nav.pull-md-right {
width: 100%!important;
clear: both!important;
float: none!important;
}
ul.nav.navbar-nav.pull-md-right > li {
width: 25%;
text-align: center;
display: inline-block!important;
}