dropdownizer
Version:
Converts HTML <select> elements into customizable dropdowns.
98 lines (84 loc) • 1.66 kB
CSS
/**
* @author Leandro Silva
* @copyright 2015, 2017 Leandro Silva (http://grafluxe.com)
* @license MIT
*/
@charset "UTF-8";
.dropdownizer {
position: relative;
font-family: sans-serif;
font-size: 11px;
user-select: none;
}
.dropdownizer:not([hidden]) {
display: inline-block;
}
.dropdownizer button, .dropdownizer ul {
background-color: #fff;
color: #000;
text-align: left;
border: 1px solid #ccc;
font-size: inherit;
}
.dropdownizer button {
position: relative;
width: 100%;
height: 100%;
border-radius: 4px;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
padding: 0 20px 0 6px;
line-height: 1.5;
white-space: nowrap;
}
.dropdownizer button:after {
content: "\25bc";
position: absolute;
font-size: 60%;
right: 8px;
top: 50%;
transform: translateY(-50%);
}
.dropdownizer ul {
display: none;
position: absolute;
list-style: none;
margin: -4px 0 0;
padding: 4px 0;
min-width: 100%;
z-index: 1;
overflow: auto;
box-sizing: border-box;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
cursor: default;
border-top: 0;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
.dropdownizer li {
padding: 1px 6px;
}
.dropdownizer li:hover {
background-color: rgba(0, 0, 0, 0.05);
}
.dropdownizer li[data-selected] {
font-weight: bold;
}
.dropdownizer[data-disabled], .dropdownizer li[data-disabled] {
background-color: transparent;
opacity: 0.4;
pointer-events: none;
}
.dd-open ul {
display: block;
}
.dd-x {
display: none;
}