Skip to content

Instantly share code, notes, and snippets.

@MedRedha
Created June 2, 2020 18:29
Show Gist options
  • Save MedRedha/e263e36a29ae52d8958fc8904d43d271 to your computer and use it in GitHub Desktop.
Save MedRedha/e263e36a29ae52d8958fc8904d43d271 to your computer and use it in GitHub Desktop.
Flush button
<button style="--content: 'Hover me!';"href="https://twitter.com/kamildyrek">
<div class="left"></div>
Hover me!
<div class="right"></div>
</button>
<a target="_blank" href="https://twitter.com/kamildyrek"><svg style="width:2em;height:2em;position:fixed;top:1em;left:1em;opacity:.8;" viewBox="0 0 24 24"><path fill="#fff" d="M17.71,9.33C18.19,8.93 18.75,8.45 19,7.92C18.59,8.13 18.1,8.26 17.56,8.33C18.06,7.97 18.47,7.5 18.68,6.86C18.16,7.14 17.63,7.38 16.97,7.5C15.42,5.63 11.71,7.15 12.37,9.95C9.76,9.79 8.17,8.61 6.85,7.16C6.1,8.38 6.75,10.23 7.64,10.74C7.18,10.71 6.83,10.57 6.5,10.41C6.54,11.95 7.39,12.69 8.58,13.09C8.22,13.16 7.82,13.18 7.44,13.12C7.81,14.19 8.58,14.86 9.9,15C9,15.76 7.34,16.29 6,16.08C7.15,16.81 8.46,17.39 10.28,17.31C14.69,17.11 17.64,13.95 17.71,9.33M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2Z" /></svg></a>
//Inspired by: https://codepen.io/ManuAlvarado22/pen/MPYqXE
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:200,900');
:root {
--text-color: hsla(210, 50%, 85%, 1);
--shadow-color: hsla(210, 40%, 52%, .4);
--btn-color: hsl(210, 80%, 42%);
--bg-color: #141218;
}
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--bg-color);
}
button {
position:relative;
padding: 10px 20px;
border: none;
background: none;
cursor: pointer;
font-family: "Source Code Pro";
font-weight: 900;
text-transform: uppercase;
font-size: 30px;
color: var(--text-color);
background-color: var(--btn-color);
box-shadow: var(--shadow-color) 2px 2px 22px;
border-radius: 4px;
z-index: 0;
overflow: hidden;
}
button:focus {
outline-color: transparent;
box-shadow: var(--btn-color) 2px 2px 22px;
}
.right::after, button::after {
content: var(--content);
display: block;
position: absolute;
white-space: nowrap;
padding: 40px 40px;
pointer-events:none;
}
button::after{
font-weight: 200;
top: -30px;
left: -20px;
}
.right, .left {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
.right {
left: 66%;
}
.left {
right: 66%;
}
.right::after {
top: -30px;
left: calc(-66% - 20px);
background-color: var(--bg-color);
color:transparent;
transition: transform .4s ease-out;
transform: translate(0, -90%) rotate(0deg)
}
button:hover .right::after {
transform: translate(0, -47%) rotate(0deg)
}
button .right:hover::after {
transform: translate(0, -50%) rotate(-7deg)
}
button .left:hover ~ .right::after {
transform: translate(0, -50%) rotate(7deg)
}
/* bubbles */
button::before {
content: '';
pointer-events: none;
opacity: .6;
background:
radial-gradient(circle at 20% 35%, transparent 0, transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),
radial-gradient(circle at 75% 44%, transparent 0, transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),
radial-gradient(circle at 46% 52%, transparent 0, transparent 4px, var(--text-color) 5px, var(--text-color) 6px, transparent 6px);
width: 100%;
height: 300%;
top: 0;
left: 0;
position: absolute;
animation: bubbles 5s linear infinite both;
}
@keyframes bubbles {
from {
transform: translate();
}
to {
transform: translate(0, -66.666%);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment