javascript - Is it possible to add an horizontal scroll bar to an html select box? -


this question has answer here:

i have below html code.

<!doctype html>  <html>    <body>      <select>        <option value="volvo">volvoooooooooooooooootooooooolargeeeeeeeeeeee</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>        <option value="volvo">volvo</option>        <option value="saab">saab</option>        <option value="opel">opel</option>        <option value="audi">audi</option>      </select>    </body>  </html>

the problem when goes beyond page gives vertical scroll bar. problem if value large select box width auto expanded accommodate width of value. don't want expand. i want horizontal scrollbar come if option value large.

how can that?

as others have said, not possible. however, there no need scrollbar on option list if goal make select small while keeping options visible. if limit width of select through css, see browser automatically makes whole width of option list visible.

select { width: 100px; } 

option list wider select

edit: see my previous answer on topic. firefox, chrome, , ie10 make option list wider select if necessary, ie9 not. other answers question link question fixes old ie: dropdownlist width in ie.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -