24
loading...
This website collects cookies to deliver better user experience
prefers-reduced-motion
which you can use to detect whether a visitor has this setting turned on.#app #box{
padding: 30px;
font-size: 30px;
border: 9px solid #32E0C4;
font-family: sans-serif;
color: #eee;
margin: auto;
background-color: #393E46;
border-radius: 15px;
animation-name: bounce;
animation-duration: 3s;
animation-iteration-count: infinite;
}
@keyframes bounce {
25% {
transform: rotate(30deg) translateX(120px);
}
50% {
transform: rotate(-30deg) translateX(-120px);
}
to {
transform: rotate(0deg) translateX(0px);
}
}
@keyframes
block below it.- animation-name: bounce;
- animation-duration: 3s;
- animation-iteration-count: infinite;
}
prefers-reduced-motion: no-preference
@media (prefers-reduced-motion: no-preference){
#app #box{
animation-name: bounce;
animation-duration: 3s;
animation-iteration-count: infinite;
}
}
The animation is only activated if the visitor has not selected to have reduced motion
The animation is not activated if the browser or operating system do not support prefers-reduced-motion
.