How do i set the 'length' of a select box?

liunx

Guest
This is a dumb question but..<br />
<br />
How do i set the 'width' of a select box?<br />
<br />
The 'size' attribute only controls how many lines are displayed, but I can't for the life of me figure out how to alter the 'width'.<br />
<br />
Thanks.<!--content-->Try this code:<br />
<br />
<select name="name" style="width:100px"><br />
<br />
better is it to make an css class(cause NS4 hates the style attribute)<!--content-->Thx!<!--content-->Originally posted by swon <br />
<select name="name" style="width:100px"><br />
<br />
<br />
That is actually incorrect code and only a buggy browser will make the selectbox 100px wide.<br />
<br />
CSS width and height doesn't apply to (non replaced) inline elements, to which basicly all form elements belong.<br />
<br />
To make it work you have to make the element into blocklevel also.<br />
<br />
Ie<br />
<br />
<select name="name" style="width:100px; display:block;"><!--content-->It works for most of browser >4 so are the most buggy browsers?<!--content-->Originally posted by swon <br />
It works for most of browser >4 so are the most buggy browsers? <br />
<br />
Sorry, ignore me.<br />
<br />
<select> happens to be a replaced inline element, and thus width do apply.<br />
:rolleyes: <br />
Time for me to sleep I guess.<!--content-->
 
Back
Top