Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <title>Example</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: sans-serif; background-color: #f0f0f0; } .strikethrough { font-size: 3rem; font-weight: bold; color: #333; position: relative; display: inline-block; } /* The invisible strike line */ .strikethrough::after { content: ''; position: absolute; top: 50%; left: -5%; /* Ensure it completely crosses the word */ right: 105%; /* Start fully drawn back */ height: 4px; background-color: #ff3b30; transform: translateY(-50%); transition: right 0.4s ease-out; } /* On hover, or programmatically added class, draw it */ .strikethrough:hover::after, .strikethrough.is-crossed::after { right: -5%; } @media (prefers-reduced-motion: reduce) { .strikethrough::after { transition: none; /* Immediately renders the line across without drawing */ } } </style> <div class="strikethrough">Cross me out</div>