<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Advanced Hover Effects</title> <style> .button { position: relative; display: inline-block; padding: 10px 20px; color: #fff; background-color: #007BFF; border: none; border-radius: 5px; text-decoration: none; overflow: hidden; transition: background-color 0.3s; } .button::before, .button::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.2); transition: transform 0.3s; } .button::before { transform: translateX(-100%); } .button::after { transform: translateX(100%); } .button:hover::before { transform: translateX(0); } .button:hover::after { transform: translateX(0); } </style> </head> <body> <a href="#" class="button">Hover Me</a> </body> </html>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter