【发布时间】:2021-05-11 04:37:52
【问题描述】:
我正在尝试创建一个响应式站点,其中当宽度减小时,我的导航链接会消失,但是有一个 *** 水平滚动条 ***,我想摆脱它。我已经为此查看了其他问题,但没有一个对我有帮助。
有什么建议么?
预先感谢
HTML
<header class="head">
<nav class="navbar">
<div class="logo">
<a href="index.html">Krishang Sharma</a>
</div>
<ul class="nav-items">
<li><a href="#">Work</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
<div class="crossMenu">
<div class="line1"></div>
<div class="line2"></div>
</div>
<!-- Theme Toggle Switch -->
<div class="switch">
<div class="bg">
<div class="circle"></div>
</div>
</div>
</nav>
</header>
CSS
.navbar{
width: 100vw;
height: 10vh;
display: flex;
align-items: center;
font-family: 'Poppins', serif;
justify-content: space-evenly;
box-shadow: 0px 15px 20px #1e1e1e;
}
.logo{
width: 40%;
}
.logo a{
color: white;
transition: 0.3s;
font-size: 1.5rem;
text-decoration: none;
}
.logo a:hover{
transition: 0.3s;
color: #639FAB;
}
.nav-items{
width: 40%;
display: flex;
justify-content: space-around;
}
.nav-items, li a{
align-items: center;
height: 100%;
font-size: 18px;
color: white;
list-style: none;
transition: 0.3s;
text-decoration: none;
}
.nav-items a:hover{
transition: 0.3s;
color: #639FAB;
}
.crossMenu{
cursor: pointer;
display: none;
margin-right: 2%;
}
.line1, .line2{
margin: 4px;
height: 4px;
width: 35px;
transition: 0.5s ease;
border-radius: 25px;
background: #639FAB;
}
.switch{
cursor: pointer;
align-items: center;
}
.bg{
height: 20px;
width: 60px;
background: white;
border-radius: 10px;
transition: 0.5s ease;
}
.circle{
right: 5px;
top: -5px;
width: 30px;
height: 30px;
position: relative;
border-radius: 50%;
transition: 0.5s ease;
background: #639FAB;
}
.circleOn{
background: white;
right: -35px;
transition: 0.5s ease;
}
.bgOn{
transition: 0.5s ease;
background: #639FAB;
}
低分辨率
.nav-items{
right: 15%;
position: absolute;
transition: 0.5s ease;
transform: translateX(200%);
}
【问题讨论】:
-
您必须正确格式化您的问题。真的好难读
标签: html css frontend web-frontend