我設置了包含邊框的標誌,我用了一個a
元素,但邊境動畫不工作,他們留他們是如何規定;我將如何製作它,以便邊框顏色可以在動畫中更改?如何爲`a`元素添加邊框顏色動畫?
.anim {
width: 20px;
height: 20px;
border: 10px solid #F44336;
display: block;
margin: 10px;
-webkit-animation: borderanim 1s ease infinite;
animation: borderanim 1s ease infinite;
}
@-webkit-keyframes borderanim {
0% {
border: 10px solid #F44336;
}
100% {
border: 10px solid #2196F3;
}
}
@keyframes borderanim {
0% {
border: 10px solid #F44336;
}
100% {
border: 10px solid #2196F3;
}
}
<div class="anim"></div>
<a class="anim" href="/"></a>
<br/>
<a class="anim" href="http://google.com/"></a>
<a class="anim" href="http://codepen.io/"></a>
<a class="anim" href="http://backpack.tf/"></a>
<a class="anim" href="javascript:location.href='http://codepen.io/';"></a>
謝謝,但是一個外部網站的鏈接將不起作用'I am meant to be an animated link.'例如不會動畫 – Skylark
哇,這確實是一些奇怪的行爲。因爲,例如'http:// google.com'可以正常工作。 '.com'作品很酷,但'.io'扮演了...... – jh3y
呀,我還鏈接到與.tf結局網站和他們有同樣的問題 – Skylark