Styled Dropdowns
by shanejones
HTML
<label>
<select>
<option selected> Select Box </option>
<option>Short Option</option>
<option>This Is A Longer Option</option>
</select>
</label>
CSS
body, html {background:#444; text-align:center; padding:50px 0;}
select {
border: 1px solid #ccc;
padding: 0.25rem 4rem 0.25rem 0.5rem;
font-size: 1rem;
margin: 0;
background: white;
border-radius: 0;
outline: none;
display: inline-block;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
select {
padding-right: 18px;
}
}
label {
position: relative;
}
label:after {
content: '';
border-bottom: 2px solid white;
border-right: 2px solid white;
width: 7.5px;
height: 7.5px;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
right: 5px;
top: 0;
padding: 0;
position: absolute;
pointer-events: none;
display: block;
}
label:before {
content: '';
right: 0;
top: -6px;
width: 20px;
height: 28px;
background: #ccc;
position: absolute;
pointer-events: none;
display: block;
}