1

I couldn't find anywhere to change the border on <option> but the background-color can be changed using option{background-color: red;} but option{border: 1px solid red;} won't work.

Using option{border: 1px solid red;} works in firefox but it's bordering each option but I wanted to border on whole option groups.

Is there any solution for this?

enter image description here

Navin Rauniyar
  • 10,127
  • 14
  • 45
  • 68
  • 1
    Here's a nice tutorial on styling options. http://css-tricks.com/dropdown-default-styling/. And here an SO question: http://stackoverflow.com/questions/8430279/how-to-style-the-option-with-only-css – TimSPQR May 26 '14 at 08:34
  • The question title refers to options, the text says you don’t want borders for options but for option groups. Please specify, by editing the question, or by closing this an posting a new one, which one you mean. Also provide a a real example, HTML and CSS, showing what you have tried and how the result differs from the expected/desired (and on which browser[s] this happens). – Jukka K. Korpela May 26 '14 at 10:44
  • I've updated with picture. And I don't have optgroup. I've only options. Should I use optgroup? – Navin Rauniyar May 26 '14 at 12:14

1 Answers1

-1

I have tried with following piece of code:

<div id ="newdiv"><select id="mysel">
<optgroup><option value="1">One</option><option value="2">Two</option></optgroup>
</select>
</div>

Used following css to provide border:

#mysel optgroup{  
 border: 1px solid red; 
}

It works as you wish in mozilla firefox.

Kerem
  • 11,377
  • 5
  • 59
  • 58
SonaliM
  • 1
  • 1