Styling the placeholder option in a select #3127
Unanswered
stephenhenckaerts
asked this question in
Help
Replies: 2 comments 1 reply
-
any solution? |
Beta Was this translation helpful? Give feedback.
1 reply
-
In Tailwind v4 (but this should also work for v3), you can do the following: <select class="has-[option.placeholder:checked]:text-gray-400">
<option value="" disabled selected class="placeholder">Foobar</option>
</select> If you don't want to set a <select class="has-[option:disabled:checked]:text-gray-400">
<option value="" disabled selected>Foobar</option>
</select> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project where I need to use a select inside a form. All other type of inputs have a placeholder with a light gray color. The text typed inside the inputs is black.
The select input of the form needs to have the same styling. The default/placeholder value needs to be shown in a dark gray and the real values that the user can select need to be shown in black. But when I try to specify a different color for the first(default/placeholder) option it doesn't use this color. It actually keeps on using the color specified in the select element.
Here is the select inside the element:
Beta Was this translation helpful? Give feedback.
All reactions