我正在使用bootstrap 4创建导航栏并进行了以下更改
答案 0 :(得分:0)
你必须包裹按钮并在div中前进并将class="clearfix-xs"
放入其中。像这样
<div class="clearfix-xs">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler hidden-lg-up float-xs-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
</button>
</div>
和这个clss的css是:
@media(max-width:768px){.clearfix-xs:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
}
这里是pen