I made a little "ultimate DVD screensaver" thing for fun, where a disc is animated to precisely hit corners, but for some reason the disc overshoots the bottom-right corner:
#box {
border: solid;
height: 85vmin;
width: 85vmin;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
#screensaver {
position: relative;
animation: DVD 5s linear infinite alternate;
left: 0px;
top: 0px;
}
@keyframes DVD {
to {
left: 100%;
top: 100%;
}
}
<div id="box"><span id="screensaver">O</span></div>
I've already tried using margin and padding instead of position, and animating from left: 0; top: 0 to right: 0; bottom: 0. Does anyone know why this happens, and if there's a way to solve it without having to fiddle with anything (e.g. if I change the height or width, I don't want to have to change anything else to make it work)?