A Pen by Emerson Pessoa on CodePen.
Created
October 20, 2023 14:27
-
-
Save emersonpessoa01/5bcd7f49201ca96be774ffe5bd426d6d to your computer and use it in GitHub Desktop.
Pure CSS select option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Choose a book format</h1> | |
<div class="select"> | |
<select name="format" id="format"> | |
<option selected disabled>Choose a book format</option> | |
<option value="pdf">PDF</option> | |
<option value="txt">txt</option> | |
<option value="epub">ePub</option> | |
<option value="fb2">fb2</option> | |
<option value="mobi">mobi</option> | |
</select> | |
</div> | |
<br> | |
<div class="select"> | |
<select name="format" id="format"> | |
<option selected disabled>Choose a book format</option> | |
<option value="pdf">PDF</option> | |
<option value="txt">txt</option> | |
<option value="epub">ePub</option> | |
<option value="fb2">fb2</option> | |
<option value="mobi">mobi</option> | |
</select> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
display: flex; | |
flex-direction: column; | |
justify-content: center; | |
align-items: center; | |
height: 100vh; | |
background: #23b499; | |
font-family: 'Open Sans', sans-serif; | |
color: #fff; | |
} | |
select { | |
-webkit-appearance:none; | |
-moz-appearance:none; | |
-ms-appearance:none; | |
appearance:none; | |
outline:0; | |
box-shadow:none; | |
border:0!important; | |
background: #5c6664; | |
background-image: none; | |
flex: 1; | |
padding: 0 .5em; | |
color:#fff; | |
cursor:pointer; | |
font-size: 1em; | |
font-family: 'Open Sans', sans-serif; | |
} | |
select::-ms-expand { | |
display: none; | |
} | |
.select { | |
position: relative; | |
display: flex; | |
width: 20em; | |
height: 3em; | |
line-height: 3; | |
background: #5c6664; | |
overflow: hidden; | |
border-radius: .25em; | |
} | |
.select::after { | |
content: '\25BC'; | |
position: absolute; | |
top: 0; | |
right: 0; | |
padding: 0 1em; | |
background: #2b2e2e; | |
cursor:pointer; | |
pointer-events:none; | |
transition:.25s all ease; | |
} | |
.select:hover::after { | |
color: #23b499; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment