[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

Width of Listbox

I have a problem in controlling the width of a listbox in IE and Netscape.
In Netscape it takes the width of the default text specified.

In IE it increases with the length of the text I am loading dynamically. How do I set a fixed width for this control so that it behaves alike in both the browsers.

As and when I load the options for the listbox, the width varies wrt the text.
  • 2
1 Solution
salurAuthor Commented:
Adjusted points to 40
Yep, you are right, you can only have 3 posibilities:

1.- Before the creation of the listbox you can count the max length of the options, set the longer as selected and in the onload() select the right one.

2.- Use an style to create it as the size you want:

<select name="example" size="1" style="width: 40mm">
<option ....></option>

3.- Use &nbsp; in the options to adjust the size.


PS: Merry X-mas

salurAuthor Commented:
Thanks a lot xabi. Its fine now....

Merry Christmas

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now