Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <style> .track { background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 8px; padding: 10px; margin-bottom: 20px; position: relative; } .track::before { content: attr(data-label); position: absolute; top: 20px; left: 80px; font-family: sans-serif; font-size: 0.9em; color: #6c757d; } .runner { width: 50px; height: 50px; border-radius: 8px; background-color: #007bff; /* Both animations take exactly 3 seconds */ animation: runAcross 3s infinite; } /* Smooth linear movement */ .smooth-linear { background-color: #dc3545; animation-timing-function: linear; } /* Stepped movement (5 distinct jumps) */ .stepped { background-color: #28a745; animation-timing-function: steps(5); } @keyframes runAcross { 0% { transform: translateX(0); } 100% { /* Move 300px to the right */ transform: translateX(300px); } } </style> <div class="track" data-label="Smooth: linear"> <div class="runner smooth-linear"></div> </div> <div class="track" data-label="Jumping: steps(5)"> <div class="runner stepped"></div> </div>