UPDATE:
I'm puzzled by the 2 downvotes without any solutions to my problem.
Issue:
The challenge I'm facing is styling the color of the selected option that acts as a placeholder.
I attempted different solutions like this one, but unfortunately, I couldn't find an HTML/CSS-based fix.
option {
color:#999;
}
/* NOT effective */
option:selected {
color:blue;
}
<select class="form-control" id="frmMaand" name="offer_request[month]">
<option value="" class="disabled-option" hidden selected>
<span style="color:#999 !important; background:#333 !important;">Select an option</span>
</option>
<option value="value1">Option 1</option>
<option value="value2">Option 2</option>
<option value="value3">Option 3</option>
<option value="value4">Option 4</option>
</select>
Note:
- I am specifically seeking a solution that does not involve JavaScript or jQuery.
I need the attributes 'hidden' and 'selected' attached to the option tag for optimal user experience.
hidden selected
Additional Information:
I aim to utilize the first option as a placeholder. It should not be visible in the dropdown list and must appear lighter in color compared to the other options.