JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="durationDropdown">
<select role="listbox" class="durationSelect">
<option value="0">Less than 1 month</option>
</select>
</div>
</div>
CSS
.container {
width: 150px;
}
.durationDropdown {
padding: 0px;
flex: 1;
text-align: left;
position: relative;
cursor: pointer;
height: 5.1875rem;
transition: 250ms;
border: 1px solid #eee;
}
.durationDropdown::after {
content: "";
display: block;
width: 40px;
top: 0%;
right: 0;
height: 100%;
position: absolute;
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 63%);
pointer-events: none;
}
.durationDropdown:hover::after,
.durationDropdown:active::after {
background: none;
}
.durationDropdown:hover {
background: black;
}
.heading {
text-transform: uppercase;
padding: 15px 20px 20px 20px;
font-size: 10px;
letter-spacing: 2px;
font-family: var(--font-avenir);
font-weight: 600;
}
.durationSelect {
transition: 250ms;
background-color: transparent;
border: 0;
font-size: 16px;
font-weight: 600;
font-family: var(--font-avenir);
color: var(--color-greyLight);
outline: none;
position: absolute;
top: 0;
height: 100%;
padding: 22px 0 0 20px;
cursor: pointer;
overflow:hidden;
}
.durationDropdown:hover .heading {
color: var(--color-greyLightest);
}
.durationDropdown:hover .durationSelect {
color: white !important;
}
.durationSelect:hover,
.durationSelect:active,
.durationSelect:focus {
background-color: transparent;
color: var(--color-greyLight);
}
@media screen and (max-width: 800px) {
.durationSelect {
font-size: 16px;
}
.durationDropdown:hover {
background: none;
}
.durationDropdown::after {
top: -8%;
}
}