Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    setting the width of SELECT fields

    OK, this is one of those questions that I'm going to kick myself over when I finally hear the answer, but here we go...

    I'm using JavaScript to create dynamic choices for some <SELECT> fields, and it works fine in itself. However, since the available choices aren't the same for every generated <SELECT> field, the fields come out sized differently. Check out the attached screen shot and you'll see what I mean. Does anyone know how to set the width of <SELECT> fields to be a consistent size? The SIZE property controls the height, or how many choices are visible at once. What I want is something similar to the SIZE property for <INPUT> fields. Thanks!

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OK, got it

    OK, I answered my own question. You can use the STYLE attribute to set the WIDTH property, like so:

    <SELECT NAME="Test" STYLE="width: 100px">
    <OPTION>Choice 1
    <OPTION>Choice 2
    <OPTION>Choice 3
    </SELECT>

    In place of pixel size, you can also use percentage values, e.g. STYLE="width: 50%".

    Hope this helps somebody,
    Sam


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •