Apparently this doesn't work:
select[multiple]{
height: 100%;
}
it makes the select have 100% page height...
auto
doesn't work either, I still get the vertical scrollbar.
Any other ideas?
Apparently this doesn't work:
select[multiple]{
height: 100%;
}
it makes the select have 100% page height...
auto
doesn't work either, I still get the vertical scrollbar.
Any other ideas?
Old, but this will do what you're after without need for jquery. The hidden overflow gets rid of the scrollbar, and the javascript makes it the right size.
And just a tiny amount of javascript
I guess you can use the
size
attribute. It works in all recent browsers.Using the size attribute is the most practical solution, however there are quirks when it is applied to select elements with only two or three options.
Simple JavaScript can be used to set the size attribute to the correct value automatically, e.g. see this fiddle.
As mentioned above, this solution does not solve the issue when there are only two or three options.
friends: if you retrieve de data from a DB: you can call this $registers = *_num_rows( Result_query ) then
You can do this with simple javascript...
...or limit height until number-of-records...
For jQuery you can try this. I always do the following and it works.