Sliding Text Button - VexaX
Run Code
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Sliding Text Button</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #000; margin: 0; } .sliding-text-button { padding: 20px 40px; font-size: 18px; font-weight: bold; color: #fff; background: #27ae60; border: none; border-radius: 30px; cursor: pointer; outline: none; overflow: hidden; position: relative; transition: all 0.3s ease; } .sliding-text-button:hover { background: #2ecc71; } .sliding-text-button span { position: relative; z-index: 1; } .sliding-text-button:before { content: attr(data-hover); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; white-space: nowrap; opacity: 0; transition: opacity 0.3s ease; } .sliding-text-button:hover:before { opacity: 1; } .sliding-text-button span { display: inline-block; transition: transform 0.3s ease; } .sliding-text-button:hover span { transform: translateY(-100%); } </style> </head> <body> <button type="button" class="sliding-text-button" data-hover="Hovered!"> <span>Sliding Text</span> </button> </body> </html>