Forum Moderators: not2easy

Message Too Old, No Replies

Controlling number of displayed entries in dropdown lists

No problems in IE, but needs something extra in moz and opera...

         

ronin

3:44 am on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi,

I'm messing about with a drop down menu on one of my pages for which I'm using a <form> select list.

The list contains about 30 items.
On IE, the drop down list drops down and displays about 10 or 11 of those items... there's a scrollbar too, so you can scroll up and down the entire list.

However, Mozilla Firebird and Opera both display between 20 and 22 items... the lists still function perfectly well, but they're not nearly as usable (I don't think so anyway...)

I checked the W3C html 4.01 spec, but had no luck in finding anything which could limit the number of items displayed on a drop down menu.

a) Can I define the number of items displayed using CSS?
b) If not, might I be able to do so using javascript?
c) If not can anyone point me towards a preferred method of creating a pure CSS dropdown menu?
d) Am I worrying about cosmetic elements on my webpages far too much >;->?

SuzyUK

11:00 am on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you using a <select> with <options>?

I saw this recently (here?)... no it wasn't I've just remebered where but can't remember if there was a solution...

hang on...

<added>
does it resemble this? [quirksmode.org]
-->Contact page --> dropdown subject list?

This does not work well in NN, though it's OK in Moz....
</added>

SuzyUK

11:14 am on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok scrap all that I see what you mean now ;)

The example given above is not the same problem..

I'll look and see what is if anything ;)

Suzy

SuzyUK

12:54 pm on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



:(

You cannot specify the number of items that are displayed in the list when users click the drop-down button. The length of the displayed list is determined by the browser.

from a couple of MS related sites but I presume it's relevant ;)

So:
a) No
b) See Blobfisk's excellent Tutorial [webmasterworld.com]
c) Pure CSS can't do (well IE can't!)... but see this [meyerweb.com]and used with a little script is probably possible.
d) maybe ;)

Suzy

ronin

2:52 pm on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Suzy >;->

That sort of confirms what I suspected anyway after not finding anything on the W3C spec.

I think I'll leave the <form> as it is... as I say, it works perfectly well, despite displaying a different number of items in each browser.

Funny thing is, 6 months ago this sort of variability in browser-display never would have bothered me...

I think starting to learn how to use CSS properly has turned me into more of a control freak...

Now I want to style everything on the page >;->