Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Shine on Hover Effect Button</title> <style> /* Component: Shine on Hover Button Description: A button with a glossy sheen that animates across on hover. */ :root { --shine-btn-bg: #343a40; --shine-btn-text-color: #ffffff; --shine-focus-outline: #343a40; --shine-speed: 0.75s; } .shine-container-1 { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; display: flex; justify-content: center; align-items: center; padding: 2rem; background-color: #f8f9fa; } .shine-btn-1 { position: relative; /* Needed to position the pseudo-element */ overflow: hidden; /* Essential to clip the shine effect */ display: inline-block; padding: 1rem 2rem; font-size: 1.1rem; font-weight: 600; color: var(--shine-btn-text-color); background-color: var(--shine-btn-bg); border: none; border-radius: 8px; cursor: pointer; text-decoration: none; } /* The shine effect pseudo-element */ .shine-btn-1::before { content: ''; position: absolute; top: 0; left: -100%; /* Start off-screen */ width: 100%; height: 100%; /* The angled sheen created with a gradient */ background-image: linear-gradient( 120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 70% ); transition: left var(--shine-speed) ease-in-out; } /* On hover, move the shine element across the button */ .shine-btn-1:hover::before { left: 100%; /* Move to the other side */ } .shine-btn-1:focus-visible { outline: 3px solid var(--shine-focus-outline); outline-offset: 3px; } </style> </head> <body> <div class="shine-container-1"> <button type="button" class="shine-btn-1">Unlock Premium</button> </div> </body> </html>