我已经在这上面尝试了一些东西,比如把svg换成png,我盯着我的格式,看不出有什么问题,我没有提出任何问题。我想知道CSS动画是否会以某种方式干扰它?
这是在其他浏览器上工作的website,在it 11上,这个圆圈在动画的末尾仍然是一个黄色圆圈。
#rosette {
z-index: 99;
position: absolute;
background-color: crimson;
height: 100vh;
width: 100vw;
animation: rosette-anim 5s;
animation-fill-mode: forwards;
content: "";
transform-style: preserve-3d;
background: rgb(51, 55, 56);
top: 0px;
right: 0px;
transform: rotateY(0.5turn);
}
@keyframes rosette-anim {
95% {
position: absolute;
background: rgb(51, 55, 56);
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(2turn);
top: 4px;
right: 20px;
}
100% {
position: absolute;
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(3turn);
background: rgb(164, 132, 60) url('https://www.pottertour.co.uk/imagesAwards/lux-life-award-transparent-min.svg');
background-size: 139px 100px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
z-index: 1;
top: 4px;
right: 26px;
}
}<div id="rosette"></div>
发布于 2020-06-23 14:07:48
伪元素的动画和过渡是not supported by IE11。您可以创建<div>并使用ID为其编写CSS,避免使用伪。示例代码如下:
#rosette {
z-index: 99;
position: absolute;
background-color: crimson;
height: 100vh;
width: 100vw;
animation: rosette-anim 5s;
animation-fill-mode: forwards;
content: "";
transform-style: preserve-3d;
background: rgb(51, 55, 56);
top: 0px;
right: 0px;
transform: rotateY(0.5turn);
}
@keyframes rosette-anim {
95% {
position: absolute;
background: rgb(51, 55, 56);
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(2turn);
top: 4px;
right: 20px;
}
100% {
position: absolute;
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(3turn);
background: rgb(164, 132, 60);
background-size: 139px 100px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
z-index: 1;
top: 4px;
right: 26px;
}
}
#before {
content: '';
position: absolute;
border-bottom: 90px solid rgb(164, 132, 60);
border-left: 50px solid transparent;
border-right: 50px solid transparent;
top: 95px;
right: 80px;
transform: translateZ(-1px) rotate(-140deg);
opacity: 0;
z-index: -1;
animation: change 5s;
animation-fill-mode: forwards;
}
#after {
content: '';
position: absolute;
border-bottom: 90px solid rgb(164, 132, 60);
border-left: 50px solid transparent;
border-right: 50px solid transparent;
top: 95px;
left: auto;
right: 10px;
transform: translateZ(-1px) rotate(140deg);
opacity: 0;
z-index: -1;
animation: change 5s;
animation-fill-mode: forwards;
}
@keyframes change {
99% {
opacity: 0;
}
100% {
opacity: 1;
}
}<div id="rosette"><img src="https://www.pottertour.co.uk/imagesAwards/lux-life-award-transparent-min.svg" id="award" alt="My private Harry Potter tours won Lux Life magazine's award for best pop culture tour Edinburgh, they anointed it 'Truly magical', bless them."
/></div>
<div id="before"></div>
<div id="after"></div>
结果为IE11:

发布于 2020-06-23 05:34:14
我为背景图像使用了::before伪元素,并为动画::before元素编写了另一个关键帧动画。这在IE11中有效。
#rosette {
z-index: 99;
position: absolute;
background-color: crimson;
height: 100vh;
width: 100vw;
animation: rosette-anim 5s;
animation-fill-mode: forwards;
transform-style: preserve-3d;
background: rgb(51, 55, 56);
top: 0px;
right: 0px;
transform: rotateY(0.5turn);
}
#rosette:before {
content: "";
background-image: url('https://www.pottertour.co.uk/imagesAwards/lux-life-award-transparent-min.svg');
background-repeat: no-repeat;
background-position: center;
background-size: contain;
/* visibility: hidden; */
animation: rosette-before 5s;
animation-fill-mode: forwards;
display: inline-block;
height: 100%;
position: absolute;
width: 100%;
opacity: 0;
}
@keyframes rosette-anim {
95% {
position: absolute;
background: rgb(51, 55, 56);
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(2turn);
top: 4px;
right: 20px;
}
to {
position: absolute;
height: 137px;
width: 142px;
border-radius: 70px;
transform: rotateY(3turn);
background-color: rgb(164, 132, 60);
z-index: 1;
top: 4px;
right: 26px;
}
}
@keyframes rosette-before {
99% {
opacity: 0;
}
100% {
opacity: 1;
}
}<div id="rosette"></div>
https://stackoverflow.com/questions/62523075
复制相似问题