Prevent listbox from resizing horizontally

Prevent listbox from resizing horizontally

am 28.06.2007 16:52:37 von Froefel

I'm looking for a way to restrict a listbox from resizing
horizontally.

The listbox sits within a and has a style="width=100%;"

This makes sure that the listbox is always as wide as its (fixed-
width) , 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

Re: Prevent listbox from resizing horizontally

am 28.06.2007 20:14:15 von dorayme

In article
<1183042357.606730.12700@m36g2000hse.googlegroups.com>,
Froefel wrote:

> I'm looking for a way to restrict a listbox from resizing
> horizontally.
>
> The listbox sits within a and has a style="width=100%;"
>
> This makes sure that the listbox is always as wide as its (fixed-
> width) , 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?
>


Your meaning is not clear. Show a URL of what you are trying.
Most people don't like code - but you don't even give this. What
can "text of an item is longer than the listbox width" mean? Text
wraps. Anyway, of all my browsers, interestingly enough, iCab is
odd man out in rendering:

"http://www.w3.org/TR/html4/strict.dtd">


Question





  • Item short

  • Item longer

  • Item that goes on or quite some time, partly being a
    history of the world....

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Pellentesque augue.Suspendisse consectetuer ...




by taking to heart and seriously the 600px width of the cell.
Horizontal scroll bars come up.

--
dorayme

Re: Prevent listbox from resizing horizontally

am 28.06.2007 20:18:37 von Ben C

On 2007-06-28, Froefel wrote:
> I'm looking for a way to restrict a listbox from resizing
> horizontally.
>
> The listbox sits within a and has a style="width=100%;"
>
> This makes sure that the listbox is always as wide as its (fixed-
> width) , nomatter how short the text of the items.

style="width=100%" is incorrect syntax, it should be "width: 100%". But
it doesn't matter, because the width of the

  • should be the full
    available width anyway (assuming you haven't floated it or anything).

    > 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?

    Something has to determine that width-- you talk about the text being
    longer than the "listbox width" but that width is a function of many
    things, including the text, and probably other features of the table.

    Post a URL because it's not clear what the exact problem is.

  • Re: Prevent listbox from resizing horizontally

    am 28.06.2007 20:39:14 von Adrienne Boswell

    Gazing into my crystal ball I observed Froefel
    writing in 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 and has a style="width=100%;"
    >
    > This makes sure that the listbox is always as wide as its (fixed-
    > width) , 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
    >

    I am assuming this is in a form, eg:


    You could try overflow on it, but, you have to consider the user. Does
    the user need to see the whole word?

    As others have said, a URL would help.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share

    Re: Prevent listbox from resizing horizontally

    am 28.06.2007 20:53:43 von a.nony.mous

    dorayme wrote:

    > Froefel wrote:
    >
    >> I'm looking for a way to restrict a listbox from resizing
    >> horizontally.
    >>
    >> The listbox sits within a and has a style="width=100%;"

    What is a listbox?

    > Your meaning is not clear. Show a URL of what you are trying.

    Certainly would help. Does he mean