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

Thread: Select Box

  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Select Box

    Hi,

    Is it possible to provid a horizontal scroll bar for the options list in a select box.
    ie.. the values inside the select box-options...
    I had tried placing the select inside the div ie..
    <div style="overflow-x:scroll; width:500px;
    overflow: -moz-scrollbars-horizontal;">
    <select....></select>
    </div>
    the problem here is its for the select box and not for the options within.

    Thanks in advance..
    arsu

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I'm not sure if I totally understand you, but try:
    Code:
    <select multiple="multiple" size="5">
    <option>Option1</option>
    <option>Option2</option>
    <option>Option3</option>
    <option>Option4</option>
    <option>Option5</option>
    <option>Option6</option>
    <option>Option7</option>
    <option>Option8</option>
    <option>Option9</option>
    <option>Option10</option>
    </select>
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by archanas View Post
    Hi,

    Is it possible to provide a horizontal scroll bar for the options list in a select box.
    ie.. the values inside the select box-options...
    AFAIK, the answer is NO.

    But the width of the select list will by default be the amount required to display the longest option.

    Code:
    <select>
    <option value = "1">Lots of extremely lengthy and complicated stuff in here</option>
    <option value = "2">x</option>
    </select>
    This width can be altered using CSS:-

    Code:
    <style type="text/css"> 
    .widthsel{ 
    width:100px; 
    } 
    </style>
    
    <select class="widthsel"> 
    <option value = "1">Lots of extremely lengthy and complicated stuff in here</option>
    <option value = "2">x</option>
    </select>


    He thought he saw a Argument
    That proved he was the Pope:
    He looked again, and found it was
    A Bar of Mottled Soap.
    "A fact so dread," he faintly said,
    "Extinguishes all hope!"
    - Lewis Carroll

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Oops, I guess there's something wrong with my comprehension on horizontal and vertical

    Thanks for the heads up Philip
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph


  •  

    Posting Permissions

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