gpt4 book ai didi

css - 如何使用css3获得这个?

转载 作者:太空宇宙 更新时间:2023-11-04 11:15:42 25 4
gpt4 key购买 nike

我希望在我的 fontAwesome 图标的边框中使用此动画。我尝试了很多但都失败了。

这是动画。

http://postimg.org/image/8k3al48kr/

最佳答案

我认为仅使用一个 HTML 元素是不可能的,但以下内容应该可行:

.square {
display: block;
width: 100px;
height: 100px;
position: relative;
}
.left, .top, .right, .bottom {
position: absolute;
width: 0px;
height: 0px;
background-color: black;
-moz-animation-duration: 1s;
-moz-animation-fill-mode: forwards;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease-in;
-webkit-animation-duration: 1s;
-webkit-animation-fill-mode: forwards;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in;
-o-animation-duration: 1s;
-o-animation-fill-mode: forwards;
-o-animation-iteration-count: 1;
-o-animation-timing-function: ease-in;
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
animation-timing-function: ease-in;
}
.left, .right {
-moz-animation-name: drawVertical;
-webkit-animation-name: drawVertical;
-o-animation-name: drawVertical;
animation-name: drawVertical;
width: 1px;
}
.top, .bottom {
-moz-animation-name: drawHorizontal;
-webkit-animation-name: drawHorizontal;
-o-animation-name: drawHorizontal;
animation-name: drawHorizontal;
height: 1px;
}
.left {
left: 0;
bottom: 0;
-webkit-animation-delay: 0s;
animation-delay: 0s;
-moz-animation-delay: 0s;
}
.top {
top: 0;
left: 0;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.right {
right: 0;
top: 0;
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.bottom {
bottom: 0;
right: 0;
height: 1px;
-webkit-animation-delay: 3s;
animation-delay: 3s;
}
@keyframes drawHorizontal {
from {
width: 0;
}
to {
width: 100%;
}
}
@keyframes drawVertical {
from {
height: 0;
}
to {
height: 100%;
}
}
<div class="square">
<span class="left"></span>
<span class="top"></span>
<span class="right"></span>
<span class="bottom"></span>
</div>

关于css - 如何使用css3获得这个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33250087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com