JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<button class="close" aria-label="Close"></button>
</div>
CSS
/*Button to quit the form*/
.close {
vertical-align: middle;
border: none;
color: inherit;
border-radius: 50%;
background: transparent;
position: relative;
width: 20px;
height: 20px;
opacity: 0.6;
}
.close:focus,
.close:hover {
opacity: 1;
background: rgba(128, 128, 128, 0.5);
}
.close:active {
background: rgba(128, 128, 128, 0.9);
}
/* tines of the X */
.close::before,
.close::after {
content: " ";
position: absolute;
top: 50%;
right: 0;
height: 20px;
width: 3px;
background-color: currentColor;
}
.close::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.close::after {
transform: translate(-50%, -50%) rotate(-45deg);
}