How do I make a placeholder for a 'select' box? – Dev

The best answers to the question “How do I make a placeholder for a 'select' box?” in the category Dev.


I’m using placeholders for text inputs which is working out just fine. But I’d like to use a placeholder for my selectboxes as well. Of course I can just use this code:

    <option value="">Select your option</option>
    <option value="hurr">Durr</option>

But the ‘Select your option’ is in black instead of lightgrey. So my solution could possibly be CSS-based. jQuery is fine too.

This only makes the option grey in the dropdown (so after clicking the arrow):

option:first {
    color: #999;

The question is: How do people create placeholders in selectboxes? But it has already been answered, cheers.

And using this results in the selected value always being grey (even after selecting a real option):

select {
    color: #999;


I just stumbled across this question, and here’s what works in Firefox and Chrome (at least):

select:invalid { color: gray; }
<select required>
    <option value="" disabled selected hidden>Please Choose...</option>
    <option value="0">Open when powered (most valves do this)</option>
    <option value="1">Closed when powered, auto-opens when power is cut</option>

The Disabled option stops the <option> being selected with both mouse and keyboard, whereas just using 'display:none' allows the user to still select via the keyboard arrows. The 'display:none' style just makes the list box look ‘nice’.

Note: Using an empty value attribute on the “placeholder” option allows validation (required attribute) to work around having the “placeholder”, so if the option isn’t changed, but is required, the browser should prompt the user to choose an option from the list.

Update (July 2015):

This method is confirmed working in the following browsers:

  • Google Chrome – v.43.0.2357.132
  • Mozilla Firefox – v.39.0
  • Safari – v.8.0.7 (the placeholder is visible in dropdown, but it is not selectable)
  • Microsoft Internet Explorer – v.11 (Placeholder is visible in dropdown but is not selectable)
  • Project Spartan – v.15.10130 (the placeholder is visible in dropdown, but it is not selectable)

Update (October 2015):

I removed the style="display: none" in favour of HTML5 attribute hidden which has wide support. The hidden element has similar traits as display: none in Safari, Internet Explorer, (Project Spartan needs checking) where the option is visible in dropdown, but it is not selectable.

Update (January 2016):

When the select element is required it allows use of the :invalid CSS pseudo-class which allows you to style the select element when in its “placeholder” state. :invalid works here because of the empty value in the placeholder option.

Once a value has been set, the :invalid pseudo-class will be dropped. You can optionally also use :valid if you so wish.

Most browsers support this pseudo-class. Internet¬†Explorer¬†10 and later. This works best with custom styled select elements; in some cases i.e. (Mac in Chrome / Safari) you’ll need to change the default appearance of the select box so that certain styles display, i.e., background-color and color. You can find some examples and more about compatibility at

Native element appearance Mac in Chrome:

Select box native Mac in Chrome

Using altered border element Mac in Chrome:

Altered select box Mac in Chrome


A non-CSS – no JavaScript/jQuery answer:

    <option value="" disabled selected>Select your option</option>
    <option value="hurr">Durr</option>

Update (December 2021):

This works for latest Firefox, Chrome, and Safari. It used to not work for many browsers in the past, as pointed out in the comments.


Something like this:


<select id="choice">
    <option value="0" selected="selected">Choose...</option>
    <option value="1">Something</option>
    <option value="2">Something else</option>
    <option value="3">Another choice</option>


#choice option { color: black; }
.empty { color: gray; }


$("#choice").change(function () {
    if($(this).val() == "0") $(this).addClass("empty");
    else $(this).removeClass("empty")


Working example:


For a required field, there is a pure-CSS solution in modern browsers:

select:required:invalid {
  color: gray;
option[value=""][disabled] {
  display: none;
option {
  color: black;
<select required>
  <option value="" disabled selected>Select something...</option>
  <option value="1">One</option>
  <option value="2">Two</option>