Forum Moderators: open

Message Too Old, No Replies

Working with Drop Downs

Could do with some pointers...

         

Nick_W

10:45 am on Sep 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I've never had to work much with dropdowns and have always considered them to be a last resort in most designs. However, they fit what I need to do currently but I have little experience of how ot get the best out of them.

So, here are a few points I'd like to talk about:

  • Can I center the text in the <option> tag?
  • Can I specify a horizontal width for the <option>
  • Can you share any other pionters or tips for getting the best out of select boxes?

I've tried using css naturally for the above: no joy. There also appears to be no way to adjust the horizontal length, it just defaults to the longest item in the <select> list.

So, any advice most welcome! ;-)

Nick

lorax

11:55 am on Sep 2, 2003 (gmt 0)

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



I have had some success with form elements by applying CSS to the container though I don't recall trying it, in this case, on the <select> (as opposed to the <option>).

As for centering - I don't think so.

I will sometimes use divider bars made out of hyphens. When I do - I make them longer than my longest string (or anticipated string if the options are dynamic). This way I at least have some foreknowledge of how wide the options will be.

DrDoc

2:44 pm on Sep 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



select {
width: 20em;
}

That always works for the width. As far as centering - no go.

Nick_W

2:50 pm on Sep 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, I vaguely remember that working on IE. I've been testing in Opera and it doesn't seem to get it....

Cheers guys

Nick