1 回答

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超3個(gè)贊
您可以像下面這樣調(diào)整您的代碼:
.collapsedSideMenu {
width: 40px;
background-color: grey;
color: white;
font-size: 12px;
position: relative;
}
.menuItem {
text-align: center;
padding: 8px;
}
.menuTitle {
position: absolute;
left:100%;
white-space:nowrap;
transform:translateY(-100%);
display:none;
padding: 8px;
background-color: blue;
color: grey;
}
.menuItem:hover + .menuTitle,
.menuTitle:hover{
display:block;
}
<div class="collapsedSideMenu">
<div class="menuItem">AB</div>
<div class="menuTitle">Option AB</div>
<div class="menuItem">CD</div>
<div class="menuTitle">Option CD</div>
<div class="menuItem">EF</div>
<div class="menuTitle">Option EF</div>
</div>
- 1 回答
- 0 關(guān)注
- 143 瀏覽
添加回答
舉報(bào)