尝试使用-webkit-text-fill-color为文本的透明度设置动画
a {
color: #fff;
-webkit-text-fill-color: rgba(255,255,255,0);
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #fff;
-webkit-text-stroke: 2px white;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
}
a:hover {
-webkit-text-fill-color: rgba(255,255,255,1);
}
由于IE上的-webkit-text-fill-color和-webkit-text-stroke的兼容性问题,我无法将颜色设置为透明。
对不起,我没有IE浏览器在我的Mac上测试它,请尝试此代码
a {
color: #d5d5d5;
-webkit-text-fill-color: rgba(225,255,255,0);
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #d5d5d5;
-webkit-text-stroke: 2px #d5d5d5;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out; /*gecko*/
-ms-transition: all .5s ease-out; /*IE10*/
-o-transition: all .5s ease-out; /*opera 11.10+*/
-pie-transition: all .5s ease-out; /*PIE*/
transition: all .5s ease-out;
}
a:hover {
color: #000;
-webkit-text-fill-color: rgba(255,255,255,1);
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #000;
-moz-transition: all .5s ease-out; /*gecko*/
-ms-transition: all .5s ease-out; /*IE10*/
-o-transition: all .5s ease-out; /*opera 11.10+*/
-pie-transition: all .5s ease-out; /*PIE*/
transition: all .5s ease-out;
}
<a href="#">Test</a>