CSS3 为 Web 开发带来了非常令人兴奋的变化,特别是 CSS 3D 转换、动画等特性的支持,可以轻松的创建很酷的 Web 效果。
CSS3新增添了实现动画效果的新功能,通过本文,你可以对这些新功能有个初步了解。今天就分享一些悬停效果,可以更好的帮助你开发
3 <div class="mask"></div>
4 </div>
CSS 仅使用mask类与border-radius属性结合打造出一个美丽的悬停效果,单击图片实现图片的可见性
复制代码代码如下:
.fourth-effect .mask {
position:absolute; /* Center the mask */
top:50px;
left:100px;
cursor:pointer;
border-radius: 50px;
border-width: 50px;
display: inline-block;
height: 100px;
width: 100px;
border: 50px solid rgba(0, 0, 0, 0.7);
box-sizing:border-box;
opacity:1;
visibility:visible;
transform:scale(4);
transition:all 0.3s ease-in-out;
}
.fourth-effect:hover .mask {
opacity: 0;
border:0px solid rgba(0,0,0,0.7);
visibility:hidden;
}
5 Example 3 <div class="mask"></div>
4 </div>
<div class="view fifth-effect">
<a href="#" title="Full Image"><img src="images/5.jpg" /></a>
<div class="mask"></div>
</div>
CSS
在这里使用边框属性的rgba属性。来改变可见图片的透明度.
复制代码代码如下:
.fifth-effect img {
opacity:0.2;
transition: all 0.3s ease-in;
}
.fifth-effect .mask {
cursor:pointer;
opacity:1;
visibility:visible;
border:100px solid rgba(0,0,0,0.7);
box-sizing:border-box;
transition: all 0.4s cubic-bezier(0.940, 0.850, 0.100, 0.620);
}
.fifth-effect:hover .mask {
border:0px double rgba(0,0,0,0.7);
opacity:0;
visibility:hidden;
}
.fifth-effect:hover img {
opacity:1;
}