Page 1 of 1

CSS: width for <select>

Posted: Wed Jul 09, 2003 10:51 pm
by nigma
Hey, when I do
select { width: 100px; }
everything works fine.

but when I do
select { width: 100%; }

the select box just dissapears. Anyone tell me why?

Thanks

Posted: Sat Jul 12, 2003 11:10 am
by patrikG
Depends on the browser. By default, select-boxes only use up as much space as the longest option-text.

Posted: Sat Jul 12, 2003 2:59 pm
by twigletmac
It's very difficult to style select lists and I've never seen a browser that can cope with resizing these when the page is resized.

Mac

Posted: Sat Jul 12, 2003 3:17 pm
by McGruff
Not sure exactly what you're trying to do but try wrapping in a div?

Re: CSS: width for <select>

Posted: Sat Jul 12, 2003 3:26 pm
by redhair
nigma wrote:Anyone tell me why?
Using '%' for defining width (or height) is just not allowed in a select field (or any other form ellement).

I would like to see that functionality to though...

Posted: Sat Jul 12, 2003 3:31 pm
by redhair
I just discovered a button is allowed to do 100% :)

Posted: Sat Jul 12, 2003 3:35 pm
by redhair
Curious...a select field to :D

What browser(s) did you use when it didnt work?
I tried IE6.0 and Mozilla 1.4, both succesfully.

Posted: Sun Jul 13, 2003 4:12 am
by twigletmac
redhair wrote:I tried IE6.0 and Mozilla 1.4, both succesfully.
Ooh , nice to see that someone's making forms easier to design :D .

Mac