我在右側有一個固定格(購物車列表)。如果項目太多,則會出現滾動條。問題是,它部分覆蓋了固定分區。當滾動條出現時,如何讓div向左推,以免被覆蓋?滾動條與固定格的內容重疊
我的CSS:
/* sidebar-right */
#sidebar-wrapper-right {
margin-left: -250px;
right: 0;
width: 250px;
background: #F5F5F5;
position: fixed;
height: 100%;
overflow-y: auto;
z-index: 1000;
top: 60px;
}
.sidebar-nav-right {
position: absolute;
top: 0;
width: 250px;
list-style: none;
margin: 0;
padding: 0;
}
.sidebar-nav-right li {
line-height: 40px;
text-indent: 20px;
}
.sidebar-nav-right li a {
color: #555;
display: block;
text-decoration: none;
}
.sidebar-nav-right li a .item-count {
margin-top: 10px;
padding-left: 0;
margin-right: 5px;
}
.sidebar-nav-right li a:hover {
color: #000;
background: rgba(255,255,255,0.8);
text-decoration: none;
}
.sidebar-nav-right > .sidebar-brand {
height: 65px;
line-height: 60px;
font-size: 18px;
}
.sidebar-nav-right > .sidebar-brand a {
color: #000;
}
.sidebar-nav-right > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#sidebar-wrapper-right .sidebar-nav-right .sidebar-right-trash {
display: inline;
margin-right: -10px;
top: 12px;
}
#sidebar-wrapper-right .sidebar-nav-right .sidebar-right-trash:hover {
background: none;
}
和HTML:
<div id="sidebar-wrapper-right">
<ul class="sidebar-nav-right">
<li class="sidebar-brand">[Shopping Cart]</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">5</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<li>
<a href="#" class="glyphicon glyphicon-trash sidebar-right-trash pull-left"></a>
<a href="market/#">[X] <span class="badge pull-right item-count">10</span></a>
</li>
<hr class="sidebar-seperator">
</ul>
</div>
你想要滾動條推動內容? –
是的,內容應該被推到左邊,所以滾動條不會重疊。 – namespace