css3 鼠标经过颜色渐变

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
    margin: 0;
    padding: 0;
}
.hover {
    width: 500px;
    height: 500px;
    background-color: red;
    -webkit-transition: all 0.5s linear;
    -moz-transition: all 0.5s linear;
    -o-transition: all 0.5s linear;
    transition: all 0.5s linear;
}
.hover:hover, .hover:focus, .hover:active {
    -webkit-transition: all 0.5s linear;
    -moz-transition: all 0.5s linear;
    -o-transition: all 0.5s linear;
    transition: all 0.5s linear;
    background-color: #000;
}

</style>
</head>
<body>
    <div class="hover"></div>
</body>
</html>

 

效果:鼠标经过颜色的变化有一个过渡,会比较好看。

posted @ 2015-01-28 17:06  白小虫  阅读(2449)  评论(0编辑  收藏  举报