效果:
鼠标悬停元素时:元素上浮 添加阴影
实现代码:
HTML部分:
<body>
<div class="top">
<ul>
<li>第一个</li>
<li>第二个</li>
</ul>
</div>>
</body>
css部分:
<style>
.top{
width: 798px;
height: 410px;
border: 1px solid black;
}
.top ul li{
float: left;
border: 1px solid red;
width: 180px;
height: 180px;
list-style-type: none;
margin-bottom: 10px;
margin-left: 20px;
-webkit-transition: all .2s linear;
}
.top ul li:hover{
-webkit-box-shadow:0 15px 30px rgba(0,0,0,.1);
box-shadow:0 15px 30px rgba(0,0,0,.3); 注:(0.3阴影颜色的深浅)
-webkit-transform:translate3d(0,-10px,0); 注:(-10px上浮的距离)
}
</style>