我用
css3从宽度设置动画线:0到宽度:100%.此刻正在从左向右移动,但我想让它从右向左开始.这与关键帧有关吗?
这是我的代码
.content {
width: 400px;
height: 200px;
color: white;
cursor: pointer;
text-transform: uppercase;
padding-bottom: 20px;
position: relative;
background: #333;
}
.content .line {
height: 2px;
background: white;
position: absolute;
top: 10px;
-webkit-animation: dude .75s 1 forwards;
-moz-animation: dude .75s 1 forwards;
-o-animation: dude .75s 1 forwards;
animation: dude .75s 1 forwards;
}
@-webkit-keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
@-moz-keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
@-o-keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
@keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
<div class="content">
<div class="line"></div>
</div>
最佳答案 见这
FIDDLE
加
.content .line {
right: 0;
}
.content {
width: 400px;
height: 200px;
color: white;
cursor: pointer;
text-transform: uppercase;
padding-bottom: 20px;
position: relative;
background: #333;
}
.content .line {
height: 2px;
background: white;
position: absolute;
top: 10px;
right: 0;
-webkit-animation: dude .75s 1 forwards;
animation: dude .75s 1 forwards;
}
@-webkit-keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
@keyframes dude {
0% {
width: 0;
}
100% {
width: 100%;
}
}
<div class="content">
<div class="line"></div>
</div>