这是一款CSS3鼠标悬停文字幻影动画特效。该特效利用before和after伪元素来制作当鼠标悬停在超链接文本上的时候的幻影效果。
使用方法
在页面中引入bootstrap.css、jquery和photoviewer.js文件。
HTML结构
在页面中添加一个元素,并设置它的data-hover属性和它的显示文字相同。
鼠标移过来
CSS样式
然后通过下面的CSS样式来制作鼠标悬停在超链接文字上的幻影动画特效。
.link{
color: #555;
font-family: 'Courgette', cursive;
font-size: 30px;
line-height: 25px;
display: inline-block;
position: relative;
z-index: 1;
transition: all 0.5s;
}
.link:hover{ color: transparent; }
.link:before,
.link:after{
content: attr(data-hover);
white-space: nowrap;
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
transition:all 0.5s;
}
.link:after{
color: #1da493;
opacity: 0;
left: -10px;
}
.link:hover:before{
left: 15px;
opacity: 0;
}
.link:hover:after{
left: 0;
opacity: 1;
transition-delay:0.1s;
}
@media only screen and (max-width: 990px){
.link span{ font-size: 20px; }
}
@media only screen and (max-width: 767px){
.link{ margin: 0 0 30px; }
}
如果觉得《html语言鼠标悬停特效 CSS3鼠标悬停文字幻影动画特效》对你有帮助,请点赞、收藏,并留下你的观点哦!