0
悬停时,我使用top
值-0.3em
进行相对定位。我预计div
向上移动,第二个div
也向上移动。但是,我有两个divs
之间的白色差距。为什么会发生,我该如何解决这个问题?相对定位:悬停
.one {
width: 3em;
line-height: 3em;
background: yellow;
}
.two {
width: 3em;
line-height: 3em;
background: red;
}
.one:hover {
line-height: 3.3em;
position: relative;
top: -0.3em;
}
<div class="one">one</div>
<div class="two">two</div>
代替提供jsfiddle的链接,最好使用堆栈溢出的“代码片段”功能。 – niyasc 2015-04-01 10:03:57