left-right movement.. css only very generic
Use transform
combined with left
or right
to avoid adding any fixed value:
@keyframes destraSinistra {
0% {
left: 0;
}
100% {
left: 100%;
transform:translateX(-100%);
}
}
#div1 {
position: absolute;
border: solid 1px lightgray;
width: 100px;
height: 30px;
background-color: lightgreen;
animation: destraSinistra 1s linear infinite alternate
}
<div id="div1"></div>