Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dislokacia/0ff3566846b9173d6fec78b06f65c81a to your computer and use it in GitHub Desktop.
Save dislokacia/0ff3566846b9173d6fec78b06f65c81a to your computer and use it in GitHub Desktop.
*,
*::before,
*::after {
box-sizing: border-box;
}
select {
/* A reset of styles, including removing the default dropdown arrow*/
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
/* Additional resets for further consistency*/
background-color: transparent;
border: 1px solid rgb(229, 229, 229);
border-radius: 5px;
padding: 10px 20px 10px 10px;
margin: 0;
width: 293px!important;
height: 43px!important;
display: block;
font-family: inherit;
font-size: inherit;
cursor: inherit;
line-height: inherit;
outline: none;
}
select::-ms-expand {
display: none;
}
:root {
--select-border: #777;
--select-focus: blue;
--select-arrow: var(--select-border);
}
.jet-select, .jet-sorting {
width: 100%;
min-width: 15ch;
/*max-width: 30ch;*/
/*border: 1px solid var(--select-border);*/
border-radius: 0.25em;
padding: 0.25em 0.5em;
font-size: 1.25rem;
cursor: pointer;
line-height: 1.1;
background-color: #fff;
background-image: linear-gradient(to top, #f9f9f9, #fff 33%);
display: grid;
grid-template-areas: "select";
align-items: center;
}
.jet-select::after, .jet-sorting::after {
content: "";
width: 9px;
height: 8px;
background-color: black;
clip-path: polygon(48% 73%, 56% 73%, 100% 21%, 100% 36%, 56% 88%, 48% 88%, 0 36%, 0 20%);
margin-right: 10px;
justify-self: end;
}
.jet-sorting {
position: relative;
}
.jet-sorting::after {
position: absolute;
top: 45%;
right: 5px;
}
select,
.jet-select:after, .jet-sorting:after {
grid-area: select;
}
@dislokacia
Copy link
Author

https://moderncss.dev/custom-select-styles-with-pure-css/
article that inspired the implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment