UNPKG

lu2

Version:

Simple and flexible UI component library based on native HTML and JavaScript

199 lines (165 loc) 4.7 kB
/** * * @Select.css * @author xinxuzhang * @create 15-06-18 * **/ select { display: inline-block; height: 40px; margin: 0; border: 1px solid #d0d0d5; border-right-width: 27px; opacity: 0.0001; font-size: 14px; font-family: simsun; filter: alpha(opacity=0); vertical-align: middle; } select[multiple] { height: auto; font-size: 38px; font-size: calc(34px - 1px); font-family: simsun; padding: 0; vertical-align: top; border-right-width: 1px; cursor: pointer; } select[multiple] > option { min-height: 38px; height: 38px; padding: 0; } select[multiple] > option:disabled { cursor: default; } select[hidden], select[hidden] + .ui-select { display: none; } .ui-select { display: inline-block; height: 40px; line-height: 20px; vertical-align: middle; -webkit-animation: fadeIn .2s; animation: fadeIn .2s; font-size: 14px; position: relative; } [multiple] ~ .ui-select { vertical-align: top; } .ui-select.active { z-index: 3; } .ui-select-button { display: block; height: 20px; padding: 9px 27px 9px 12px; color: #4c5161; border: 1px solid #d0d0d5; border-radius: 4px; background-color: #fff; text-decoration: none; -webkit-transition: border-color .15s, background-color .15s; transition: border-color .15s, background-color .15s; cursor: pointer; } .ui-select-button:hover { color: #4c5161; border-color: #ababaf; } :not(:disabled) + .ui-select > .ui-select-button:active { background-color: #f7f9fa; } .active > a.ui-select-button { border-color: #2486ff; border-radius: 4px 4px 0 0; } .reverse > a.ui-select-button { border-radius: 0 0 4px 4px; } .ui-select-text { display: block; width: 100%; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } .ui-select-icon { position: absolute; width: 20px; height: 20px; background: url(images/Select/icon-arrow.png) no-repeat center; background: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiIHZpZXdCb3g9IjAgMCAyMDAgMjAwIj48cGF0aCBmaWxsPSIjMjQ4NmZmIiBkPSJNMTQ1LjY1OSw2OC45NDljLTUuMTAxLTUuMjA4LTEzLjM3Mi01LjIwOC0xOC40NzMsMEw5OS40NzksOTcuMjMzIEw3MS43NzIsNjguOTQ5Yy01LjEtNS4yMDgtMTMuMzcxLTUuMjA4LTE4LjQ3MywwYy01LjA5OSw1LjIwOC01LjA5OSwxMy42NDgsMCwxOC44NTdsNDYuMTgsNDcuMTRsNDYuMTgxLTQ3LjE0IEMxNTAuNzU5LDgyLjU5OCwxNTAuNzU5LDc0LjE1NywxNDUuNjU5LDY4Ljk0OXoiLz48L3N2Zz4NCg==) no-repeat center, none; background-size: 20px 20px; right: 7px; top: 10px; } .ui-select-datalist { position: absolute; left: 0; right: 0; top: 39px; display: none; max-height: 304px; padding: 0; border: 1px solid #2486ff; background-color: #fff; overflow: auto; } [multiple] ~ .ui-select > .ui-select-datalist { position: static; display: block; max-height: none; height: inherit; border-color: #d0d0d5; border-radius: 4px; -ms-box-sizing: border-box; box-sizing: border-box; } [multiple]:hover ~ .ui-select > .ui-select-datalist { border-color: #ababaf; } [multiple]:focus ~ .ui-select > .ui-select-datalist { border-color: #2486ff; } .ui-select-datalist::-webkit-scrollbar { width: 8px; height: 8px; } .ui-select-datalist::-webkit-scrollbar-thumb { background-color: #bbb; border-radius: 8px; } .ui-select-datalist::-webkit-scrollbar-thumb:hover { background-color: #aaa; } .ui-select-datalist::-webkit-scrollbar-track-piece { background-color: #ddd; } .active > .ui-select-datalist { display: block; } .reverse > .ui-select-datalist { top: auto; bottom: 39px; } .ui-select-datalist-li { display: block; line-height: 20px; padding: 9px 12px; color: #4c5161; background-color: #fff; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; -webkit-transition: background-color .15s; transition: background-color .15s; overflow: hidden; cursor: pointer; } .ui-select-datalist-li:empty { display: none; } /* reset default a:hover */ .ui-select-datalist-li:hover { color: #4c5161; } .ui-select-datalist-li[href]:hover, [multiple] ~ .ui-select .ui-select-datalist-li[href] { color: #4c5161; background-color: #f0f7ff; } .ui-select-datalist > .selected { background-color: #e0f0ff; } /* disabled */ select[disabled] { cursor: default; } select[disabled] + .ui-select { opacity: .4; filter: alpha(opacity=40); -webkit-animation: none; animation: none; } select[disabled] + .ui-select .ui-select-button, select[disabled] + .ui-select .ui-select-datalist { cursor: default; border-color: #ababaf; } /* error */ .error .ui-select-button, .error[multiple] ~ .ui-select .ui-select-datalist { border-color: #f4615c; }