Jump to content

How to style option element


Recommended Posts


<select data-drupal-selector="edit-number-of-bedrooms" class="form-select required form-control" id="edit-number-of-bedrooms" name="number_of_bedrooms" required="required" aria-required="true"><option value="" selected="selected">- Select -</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select>
option {
    border: 1px solid red;

It did not work. How can I style option elements?



Link to comment
Share on other sites

There's limited amount of styling you can do with normal select dropdown, thats why its usually converted to unordered list where you can style however you want and the value is added to hidden selected dropdown element OR input type hidden element by javascript.

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...