|
Posted by Jonathan N. Little on 06/29/07 14:25
Andrew Bailey wrote:
> "Froefel" <hansdeschryver@gmail.com> wrote in message
> news:1183042357.606730.12700@m36g2000hse.googlegroups.com...
>> I'm looking for a way to restrict a listbox from resizing
>> horizontally.
>>
>> The listbox sits within a <td> and has a style="width=100%;"
>>
>> This makes sure that the listbox is always as wide as its (fixed-
>> width) <td>, nomatter how short the text of the items.
>> However, when the text of an item is longer than the listbox width,
>> the listbox is resized horizontally to accommodate the text. I would
>> like to prevent that from happening, so that either the text gets cut
>> off, or a horizontal scroll bar appears.
>>
>> Can this be done with CSS or any other way?
>>
>> -- Hans
>>
>
> Hi Hans,
>
> If you mean...
>
> <select........>
> <option........>
> <option........>
> </select>
>
> (I believe they're called either "dropdown menus" or "combo boxes")....
There is no "combobox" in HTML, but requires the pairing of a text
input with a select element and some JavaScript....but using the size
attribute will give you the traditional listbox
<select size="5">
<option>Apple</option>
<option>Peach</option>
<option>Pear</option>
<option>Pineapple</option>
<option>Orange</option>
<option>Blueberries</option>
<option>Raspberries</option>
<option>Gooseberries</option>
<option>Grapes</option>
</select>
>
> then you are on the right track by using "style" to force a width. You
> mention that the containing <td> has a fixed width, why don't you try adding
> that width to the "style" option instead of 100%?
>
> <select style="width: 300" .......>
Well, no this in incorrect the width property would require the units.
<select style="width: 300px" ... >
or better:
<select style="width: 30em" ... >
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|