LIVE DEMOCSS:爲什麼菜單邊框在滾動條出現時不出現?
考慮下面的菜單例如:(注意紅色邊框)
<div class="menu-wrapper">
<div class="menu-item">Hello</div>
<div class="menu-item">Stack</div>
<div class="menu-item">Overflow</div>
</div>
.menu-wrapper {
display: flex;
flex-direction: column;
width: 200px;
background-color: #ccc;
border-left: 5px solid #bbb;
height: 300px;
}
.menu-item {
padding: 20px;
cursor: pointer;
}
.menu-item:hover {
margin-left: -5px;
background-color: #444;
color: #fff;
border-left: 5px solid red;
}
現在,想象的menu-wrapper
的高度小,我們希望垂直滾動酒吧出現。例如,我們可以更換:
height: 300px;
有:
但是,the red border disappears then:
這是爲什麼?你會如何解決這個問題?
非常好,謝謝!顯然,在'menu-item'中添加'flex-shrink:0;'也解決了底部填充問題:http://jsbin.com/katagara/1/edit –