This may be a question for Javascript or CSS, or perhaps there's something I'm not thinking of.
What I have is a select menu that is too wide for the layout of my page. The reason is that some of the items in it are much wider than others. This menu is based on the current page and most of the items in the list are very short. Of course when one of the longer items is selected it's fine to have the menu be wider, but when a short item is selected is there any way to not have all the extra whitespace based on the longest item in the list?
I tried setting a width, but of course this just is standard then regardless of which item is selected and cuts off the longer ones.
I don't know how this would be approached using Javascript because it is variable width based on letters and that's not something easy to measure.
---
An alternative (actually my preference if possible) is to display something else when the menu is not open and when it is open the regular select menu. Plain text with a box around it would be fine (and I can work on the details later once that's setup).
The site already requires Javascript [there's a non-JS fallback], so it's not a problem if this must be done with Javascript writing and rewriting the select or something.
---
Thanks in advance for ideas.
I don't have a test page up for the moment because it's a component of something else, but if you need a demo I can create one-- but it's mostly irrelevant because this is just a general question, not specific to my site.



Reply With Quote


Bookmarks