我有一个侧边栏菜单,但我称之为position:fixed;
内容部分不认为侧边栏是一个障碍,并进入它。我该如何解决这个问题?
aside{
position: fixed;
top: 0;
left: 0;
width: 200px;
display: flex;
justify-content: center;
flex-direction: column;
padding: 1rem;
z-index: 1000;
background-color: #f9f9f9;}
aside .logo{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-bottom: 2rem;
}
aside .logo img{
width: 150px;
height: auto;
object-fit: cover;
}
aside .logo h1{
font-size: 1.5em;
font-weight: 500;
}
aside .menu-one{
display: flex;
flex-direction: column;
}
aside .menu-one h4{
font-size: 1.3em;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
}
aside .menu-two{
display: flex;
flex-direction: column;
}
aside .menu-two h4{
font-size: 1.3em;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
}
aside .menu-one ul{
display: flex;
flex-direction: column;
margin-bottom: 2.5rem;
}
aside .menu-one ul li{
margin-left: 1rem;
list-style-type: none;
margin-top: 20px;
}
aside .menu-one ul li a{
font-size: 1.1em;
transition: 200ms all;
color: rgba(0, 0, 0, 0.7);
}
aside .menu-two ul li a{
transition: 200ms all;
font-size: 1.1em;
color: rgba(0, 0, 0, 0.7);
}
aside .menu-one ul li a:hover{
color: rgba(0, 0, 0, 1.0);
}
aside .menu-two ul li a:hover{
color: rgba(0, 0, 0, 1.0);
}
aside .menu-two ul li a i{
font-weight: 500;
width: 30px;
font-size: 1.2em;
height: 30px;
}
aside .menu-one ul li a i{
font-weight: 500;
width: 30px;
font-size: 1.2em;
height: 30px;
}
aside .menu-two ul{
display: flex;
align-items: flex-start;
flex-direction: column;
}
aside .menu-two ul li{
margin-left: 1rem;
list-style-type: none;
margin-top: 20px;
}
.cizgi{
width: 80px;
height: 2px;
background-color: rgba(0, 0, 0, 0.2);
}
<aside>
<div class="logo">
<img src="https://upload.wikimedia.org/wikipedia/commons/6/61/Wikipedia-logo-transparent.png">
<h1>WİKİPEDİA</h1>
</div>
<div class="menu-one">
<h4>Sayfalar</h4>
<div class="cizgi"></div>
<ul>
<li><a href="#"><i class="far fa-home"></i> Anasayfa</a></li>
<li><a href="#"><i class="far fa-id-card"></i> Hakkımızda</a></li>
<li><a href="#"><i class="far fa-book-alt"></i> İçindekiler</a></li>
<li><a href="#"><i class="far fa-stream"></i> Maddeler</a></li>
</ul>
</div>
<div class="menu-two">
<h4>Katılım</h4>
<div class="cizgi"></div>
<ul>
<li><a href="#"><i class="far fa-hands-helping"></i> Bağış</a></li>
<li><a href="#"><i class="far fa-house-flood"></i> Köy Çeşmesi</a></li>
<li><a href="#"><i class="far fa-store-alt"></i> Wikimedia</a></li>
<li><a href="#"><i class="far fa-question-circle"></i> Yardım</a></li>
</ul>
</div>
</aside>
你的意思是你的侧边栏重叠你的内容部分,那么请尝试给你的内容部分左填充
.content-part { padding-left:200px //equal to aside width}