我正在尝试创建一个可折叠的 Bootstrap 导航栏。当我调整浏览器大小时,切换不会出现。我尝试将代码更改为我在其他论坛上看到的代码,例如对我的徽标和按钮进行分组,但这会弄乱布局。我将不胜感激任何帮助,谢谢!
@media (max-width: 991.98px) {
.collapse {
position: fixed;
top: 56px; /* Height of navbar */
bottom: 0;
left: 100%;
width: 100%;
padding-right: 1rem;
padding-left: 1rem;
overflow-y: auto;
visibility: hidden;
background-color: #343a40;
transition: visibility .3s ease-in, -webkit-transform .3s ease-in-out;
transition: transform .3s ease-in, visibility .3s ease-in-out;
transition: transform .3s ease-in, visibility .3s ease-in-out, -webkit-transform .3s ease-in-out;
}
.collapse.open {
visibility: visible;
-webkit-transform: translateX(-100%);
transform: translateX(-100%)
}
}
<div class=".container-fluid">
<nav role="navigation" class="navbar navbar-expand-md fixed-top navbar-dark bg-dark">
<a class="navbar-brand mr-auto mr-lg-0" href="./index.html">
<img src="./images/logo.svg" class="logo" alt="sultry silk logo">
</a>
<button class="navbar-toggle collapse p-0 border-0" type="button" data- toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>```
慕森王
波斯汪
相关分类