Skip to content

Instantly share code, notes, and snippets.

@diego-betto
Created October 3, 2024 08:20
Show Gist options
  • Save diego-betto/a0a9b2e55d8c1434db5c43d55838fbad to your computer and use it in GitHub Desktop.
Save diego-betto/a0a9b2e55d8c1434db5c43d55838fbad to your computer and use it in GitHub Desktop.
CSS: select with placeholder gray, options and selected values black
<style>
select {
color: #747474;
&:has(option:checked:not(:disabled)) {
color: #2c2c2c;
}
}
option {
color: #2c2c2c;
}
</style>
<select>
<option value="" disabled selected>PLACEHOLDER</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment