UNPKG

react-hover-fill-button

Version:
31 lines (29 loc) 623 B
.button { border: 2px solid red; background: white; padding: 10px; text-transform: uppercase; font-weight: bold; letter-spacing: 0.2em; position: relative; max-width: 100px; } .filler { content: attr(data-content); display: flex; justify-content: center; align-items: center; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: red; color: white; clip-path: polygon(0 0, -65% 0, 0% 100%, 0% 100%); transition: clip-path 0.5s; } .button:hover .filler, .button:focus .filler { clip-path: polygon(0 0, 100% 0, 165% 100%, 0% 100%); }