2

I have a select tag with options in it, using css I've made them all display none, except one (the very last one) I've made it display block, but it won't show up, is it because there is a lot of options?

<select>
     <option>example1</option>
     <option>example2</option>
     <option>example3</option>
</select>

Here is an example

Update

when I reduce options it works fine, Here is an example

pnuts
  • 58,317
  • 11
  • 87
  • 139
zakaria
  • 93
  • 10
  • Post your css as well please. I have a feeling your display:none is affecting them all. – VikingBlooded Oct 26 '15 at 21:39
  • 1
    It shows up in Chrome. You could use the !important at the end to overwrite the original css. – Sebass van Boxel Oct 26 '15 at 21:41
  • 2
    @SebassvanBoxel nonsense, as inline always trumps external anyway the `!important` will do nothing. Also, in my Chrome the last item is showing up fine. TS likely sees a browser bug resulting from a dropdown with 2000 items. – Niels Keurentjes Oct 26 '15 at 21:48
  • 1
    You cant give options styles, look here: [StackOverflow](http://stackoverflow.com/questions/9234830/how-to-hide-a-option-in-a-select-menu-with-css) – VikingBlooded Oct 26 '15 at 21:50
  • Using `display` on an option is non-standard and browsers will react in different ways to it. When I try it, it works as you expect in Firefox, but Chrome shows no items and IE shows all items. – Guffa Oct 26 '15 at 21:53
  • @VikingBlooded see the example! all the css is in there, and the problem is also. [Link](https://jsfiddle.net/rkh4gtzr/2/) – zakaria Oct 26 '15 at 21:54
  • @NielsKeurentjes That's what am thinking too, but it's important for me to have a lot of options. – zakaria Oct 26 '15 at 21:59
  • Then why are you hiding all of them? (hint: you have a [huge XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem)) – Niels Keurentjes Oct 26 '15 at 22:00
  • @NielsKeurentjes because I am not sure about it. – zakaria Oct 26 '15 at 22:06

1 Answers1

0

Options can't have styles according w3c standart. You can change color and background only. Select may contains only 999 options. You can delete some extra options and left 999 and it will be works.