Sliding Button code:
1.index.html:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Sliding Button</title> <link rel="stylesheet" href="style.css"> </head> <body> <a href="#" data-title="Button">Button</a> </body> </html>
2.style.css:
body { margin: 0; padding: 0; font-family: Verdana, Geneva, Tahoma, sans-serif; } a { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-decoration: none; text-transform: uppercase; font-size: 36px; color: black; letter-spacing: 5px; border: 4px solid black; padding: 10px 20px; box-sizing: border-box; overflow: hidden; } a::before { content: attr(data-title); position: absolute; top: 0; left: 0; background: black; color: white; padding: 10px 20px; box-sizing: border-box; transition: 0.3s; } a::after { content: attr(data-title); position: absolute; top: 0; left: 0; background: white; color: black; padding: 10px 20px; box-sizing: border-box; transition: 0.3s; } a:hover::before { top: 0; } a:hover::after { top: -100%; }