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 4 of 4
  1. #1
    qim
    qim is offline
    Regular Coder
    Join Date
    Mar 2013
    Location
    Andorra
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Width of <select>

    I have a number of fields in a form and would like the select field to be the same width. I found a site with a solution:
    http://www.blooberry.com/indexdot/ht...electwidth.htm

    <select name="foo" width="300" style="width: 300px">
    <option>one </option>
    <option>two </option>
    <option>three </option>
    </select>
    I know what to do with the HTML form but am unsure of exactly what to add to my CSS stylesheet.

    can you help, please?

    Thank you

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,093
    Thanks
    23
    Thanked 594 Times in 593 Posts
    This: style="width: 300px" is in-line styling so nothing needs to be added to the main style file. If you absolutly need to move the styling to the css file then you need to add a class or an id to the SELECT and put this in the file:
    Code:
    #idSelectName{width:300px;}
    and remove the in-line styling.

    FYI: width="300" can be removed from the select tag in either case.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    qim
    qim is offline
    Regular Coder
    Join Date
    Mar 2013
    Location
    Andorra
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much Sunfighter

    In fact, mneanwhile, I found that all you have to do is to reduce the size of the entries (in this case, coutries of the world, where United States of America were the main culprit...) I solved it by reducing the length of the entries i.e. United States (USA). I am going to play with your code to see if it is better.

    meanwhile, maybe you can help me with another CSS problem: I have apage with one sidebar and a main area. I would like to get another sidebar on the other side, but everything I tried does not work, e.g. margin-left: auto ;
    margin-right: auto ;

    but all this does is to push to exiasting sidebar down, as if assuming that the space to the left and right belongs to it as a margin.

    Can you help, please?

    Thank you

  • #4
    qim
    qim is offline
    Regular Coder
    Join Date
    Mar 2013
    Location
    Andorra
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    MOVED under diffrent title in HTML & CSS


  •  

    Posting Permissions

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