这是我想要动画发生的HTML和CSS代码
null
.pig {
animaton-name: apple;
animation-duration: 3s;
}
@keyframe apple {
from {
top: 0px;
}
to {
right: 200px;
}
}
<div class='pig'>
<h2> About me </h2>
</div>
null
我试图使我的标题向右移动,但它不起作用,我是CSS的新手,我正在使用网上的资源,但我不知道我哪里出错了。
首先添加位置:绝对
,然后编辑您的动画-名称
到动画-名称
,最后一个是编辑您的关键帧
到关键帧
null
.pig {
animation-name: example;
animation-duration: 3s;
position: absolute;
}
@keyframes example {
from {
right: 0px;
}
to {
right: 200px;
}
}
<div class='pig'>
<h2> About me </h2>
</div>
试试这个
null
.pig{
animation: 3s linear 0s apple;
}
@keyframes apple {
from {
transform: translateX(0px);
}
to {
transform: translateX(200px);
}
}
<div class = 'pig'>
<h2> About me </h2>
</div>
这是它将帮助你移动你的头部向右
null
.pig {
animation-name: example;
animation-duration: 3s;
position: absolute;
}
@keyframes example {
from {
left: 0px;
}
to {
left: 200px;
}
}
<div class='pig'>
<h2> About me </h2>
</div>