JSFiddle - React, Tailwind, and code Playground
by Alexey Demin
HTML
<p>
<button>
<span class="highlight"></span>
<span class="text">Button</span>
</button>
</p>
<p>
<button>
<span class="highlight"></span>
<span class="text">Really Long Text</span>
</button>
</p>
CSS
button {
background-color: #22292e;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(1, rgb(47,55,61)),
color-stop(0, rgb(26,31,36))
);
border: 1px solid #0b1319;
color: #aeb6bc;
font-size: 14px;
font-weight: bold;
border-radius: 3px;
padding: 8px 14px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
box-shadow: 0 2px 4px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.2) inset;
position: relative;
cursor: pointer;
-webkit-transition: color 0.3s ease-in-out;
}
.highlight {
width: 70px;
height: 1px;
position: absolute;
left: 0;
top: 0;
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0,rgba(255,255,255,0.0)),
color-stop(0.35,rgba(255,255,255,0.6)),
color-stop(0.7,rgba(255,255,255,0.6)),
color-stop(1,rgba(255,255,255,0))
);
opacity: 0.2;
-webkit-transition: opacity 0.3s ease-in-out;
}
button:hover .highlight {
opacity: 1;
}
button:hover {
color: #FFF;
}
body {
font-family: Arial;
background: #212830;
}
p {
margin: 10px 0 20px 0;
}