[thelist] SELECT form larger than what's on display.

Hassan Schroeder hassan at webtuitive.com
Wed Jun 25 17:11:32 CDT 2003


Damien COLA wrote:

> I'd like a way to make a SELECT have a fixed size, but when the user
> clicks on it, the drop down list is larger than the initial row. That is
> the drop down list is sized to fit the largest row, but the top line,
> the one with the down arrow, stays the width it had.
> 
> I know in HTML it isn't possible, 

Actually, Mozilla works that way by default; just set the width you
want in your CSS. But you can do something like this to have nearly
the same behavior in IE and Opera --

<style type="text/css">
#g {
	width: 4em;
	}
</style>

<select size="1"
	name="g"
	id="g"
	onfocus="if(document.all){this.style.width='auto';}"
	onblur="if(document.all){this.style.width='4em';}">
<option value="1">one</option>
<option value="1">one</option>
<option value="1">one</option>
<option value="1">one</option>
<option value="1">one</option>
<option value="1">one</option>
<option value="1">one</option>
<option value="10">one really wide item</option>
</select>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list