如果需要响应式的让".navbar-nav"里的内容隐藏,必须在以下代码的第三行设置:
.navbar-expand{-sm|-md|-lg|-xl}
其对应的是在不同屏幕宽度时进行菜单项目的显示和隐藏。
<nav class="navbar navbar-expand-md navbar-light">
...
</nav>
<template>
<div class="header">
<nav class="navbar navbar-expand-md navbar-light">
<a class="navbar-brand" href="#">
<img src="../assets/images/logo_PB.png" width="150" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Préstamos en vivo <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Invierte</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pide tu préstamo</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><span class="text-blue">Ingresar</span></a>
</li>
</ul>
</div>
</nav>
</div>
</template>
<script>
export default {
data() {
return {
}
},
}
</script>
<style media="screen">
@media (min-width: 796px){
.navbar-expand-lg {
-ms-flex-flow: row nowrap;
/* flex-flow: row nowrap; */
-ms-flex-pack: start;
/* justify-content: flex-start; */
}
}
/*@media (min-width: 768px) and (max-width: 1000px) {
.collapse {
display: none !important;
}
}*/
.header {
box-shadow: none;
transition: all 0.4s ease-in-out 0s;
z-index: 900;
background: rgba(255, 255, 255, 1);
width: 100%;
position: fixed;
top:0;
left:0;
border-bottom: 1px solid #c6c6c5;
}
.header .container-fluid {
width: 95%;
}
.navbar-nav > li > a{
text-transform: uppercase;
font-size: 12px;
color: #7b7b7c;
letter-spacing: .8px;
font-weight: 900;
font-family: 'Open Sans', sans-serif;
}
.text-blue{
color:#0181c2;
}
</style>