尝试使“tab2”随导航栏移动。 (当您悬停导航时,框会随之移出) http://jsfiddle.net/Bz5mn/ 帮助!
#nav
{
min-width: 60px;
width:5%;
height:100%;
background-color: rgba(1,1,1,0.3);
position: absolute;
top: 0;
left: 0;
transition-duration:0.4s;
overflow: hidden;
}
最佳答案
试试 adjacent sibling selector .你可以做类似的事情
#nav:hover + #tab2 {
margin-left: 5%;
}
您还想将过渡添加到 #tab2
声明,以便动画匹配。
另请注意,此选择器 only works in IE 9+
关于html - 相对和绝对位置 CSS HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18384578/