views:

89

answers:

1
< select size="2" multiple>
    < 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>
    < option value="11">11< /option>
    < option value="12">12< /option>
    < option value="13">13< /option>
< /select>

size attribute of Select tag is not working properly in Safari.

if size attribute's value is greater than four then there have no problem, its working. But when I set the value of size less than four then it show four values.

above example displays four options in safari but I want two options. What is the reason for this ?

+1  A: 

I'm not sure what the reason is, but you can style the element using height. Unfortunately, this makes it awkward to get it to look the same in each browser, although the example below looks close enough:

http://jsfiddle.net/D7ugW/

Andy E
Thanks But it is not working with IE
Karandeep Singh
@Karandeep Singh: Which version of IE? It works for me in 8. You could use a combination of `size=2` and `height: 36px` (or so), which would work in the version of IE it's not working for you in.
Andy E
I am using 7 version.
Karandeep Singh