<div class="abc">
</div>
.abc{
background: url("blah.jpg") no-repeat;
width:200px;
height:200px;
}
My background image is 200 x 600. How do I move it up and down the div (I want the div to remain 200x200, but the longer image goes up and down.)
I don't want to use Javascript to do this. (Because doing it that way won't use the hardware and will be slow.)
<div class="abc">
</div>
.abc{
background: url("blah.jpg") no-repeat;
width:200px;
height:200px;
}
My background image is 200 x 600. How do I move it up and down the div (I want the div to remain 200x200, but the longer image goes up and down.)
I don't want to use Javascript to do this. (Because doing it that way won't use the hardware and will be slow.)
Share Improve this question edited Dec 3, 2010 at 3:25 TIMEX asked Dec 3, 2010 at 3:19 TIMEXTIMEX 273k368 gold badges802 silver badges1.1k bronze badges1 Answer
Reset to default 5@keyframes bounce-background {
from {
background-position: top;
}
50% {
background-position: bottom;
}
to {
background-position: top;
}
}
.abc {
animation-name: bounce-background;
animation-timing-function: ease-in-out;
animation-duration: 2s;
animation-iteration-count: infinite;
/* For Chrome & Safari */
-webkit-animation-name: bounce-background;
-webkit-animation-timing-function:ease-in-out;
-webkit-animation-duration:2s;
-webkit-animation-iteration-count:infinite;
}
You should repeat these non-finalized CSS3 properties under vendor prefixes for the browsers you're supporting (e.g. @-moz-keyframes
@-o-keyframes
@-webkit-keyframes
etc.).