我有这个小边框动画但左上角有鬼,黑点,我不知道怎么摆脱它...你可以在这里查看:http://codepen.io/xaeoc/pen/xGRgze
body {
background-color: #333;
height: 230px;
}
.lluv {
width: 230px;
height: 230px;
border: solid red 1px;
position: absolute;
left: calc(50% - 115px);
}
.ondas1 {
border-radius: 50%;
border-width: 3px;
border-style: solid;
position: absolute;
animation: ondas1 1s ease-out;
}
@keyframes ondas1 {
0% {
width: 0px;
height: 0px;
top: calc(50% - 0px);
left: calc(50% - 0px);
border-color: rgba(255, 255, 255, .7);
}
100% {
width: 200px;
height: 200px;
top: calc(50% - 100px);
left: calc(50% - 100px);
border-color: rgba(255, 255, 255, 0);
}
}
答案 0 :(得分:1)
使用forwards
应为animation: ondas1 1s ease-out forwards;
演示 - http://codepen.io/victorfdes/pen/EjNWNY
的更多解释动画完成后,它会进入默认状态,其中border 3px
就是你在使用forwards
时看到左上角的圆角元素的原因,动画不是默认声明而是它转到keyframe
答案 1 :(得分:0)
这是由于ondas1
中的边界。这可以解决您的问题。
<强> CSS 强>
body {
background-color: #333;
height: 230px;
}
.lluv {
width: 230px;
height: 230px;
border: solid red 1px;
position: relative;
overflow: hidden;
left: calc(50% - 115px);
}
.ondas1 {
border-radius: 50%;
border-width: 3px;
border-style: solid;
left:-10px;
position: absolute;
animation: ondas1 1s ease-out;
}
@keyframes ondas1 {
0% {
width: 0px;
height: 0px;
top: calc(50% - 0px);
left: calc(50% - 0px);
border-color: rgba(255, 255, 255, .7);
}
100% {
width: 200px;
height: 200px;
top: calc(50% - 100px);
left: calc(50% - 100px);
border-color: rgba(255, 255, 255, 0);
}
}