# Minimal CSS play/pause gif #code Default: Animation plays. Stops when clicked. Prefers reduced motion: Animation stopped. Plays when clicked. ```css .gif input { position: absolute; left: -9999px; } .gif input + img + img, .gif :checked + img { display: none; } .gif :checked + img + img { display: inline; } @media (prefers-reduced-motion: reduce) { .gif input + img, .gif :checked + img + img { display: none; } .gif input + img + img, .gif :checked + img { display: inline; } } ``` ```html ``` This works at least as far back as Netscape 7.2 from 2004. Demo: You can get rid of the media query if you switch the order of the ``s. Then gifs will default to paused regardless of motion preference. ie: ```css .gif input { position: absolute; left: -9999px; } .gif input + img + img, .gif :checked + img { display: none; } .gif :checked + img + img { display: inline; } ``` ```html ```