JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="button">
<div class="button__text">Button text</div>
</div>
</body>
</html>
CSS
body {
background-color: #222;
}
.button {
background-color: white;
padding: 20px;
border-radius: 40px;
margin: 40px;
width: 250px;
position: relative;
}
.button::before{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: transparent;
content: '';
border-radius: inherit;
transition: 0.5s;
}
.button__text {
position: relative;
z-index: 1;
color: black;
}
.button:hover::before {
background-color: black;
}
.button:hover .button__text {
color: white;
}