我正在使用以下代碼在懸停上顯示隱藏的div。我正在使用CSS transition
屬性來淡入隱藏的div。是否可以滑動隱藏(例如從左到右)的div而不是淡入淡出只使用CSS? 這裏是我的代碼:使用CSS轉換移動div
HTML
<div class="box">
<a href="#"><img src="http://farm9.staticflickr.com/8207/8275533487_5ebe5826ee.jpg"></a>
<div class="hidden"></div>
</div>
CSS
.box{
position: relative;
}
.box .hidden{
background: yellow;
height: 300px;
position: absolute;
top: 0;
left: 0;
width: 500px;
opacity: 0;
transition: all 1s ease;
}
.box:hover .hidden{
opacity: 1;
}
演示: http://jsfiddle.net/u2FKM/
不要使用W3Schools的爲引用請,這是爲什麼:http://w3fools.com / – wandarkaf