Controlling the width of SELECT lists (HTML)

Send Us a Sign! (Contact Us!)
--> (Word) --> (PDF) --> (Epub) --> (Text)
--> (XML) --> (OpenOffice) --> (XPS) --> (MHT)

The Issue

The default width of a SELECT form control is usually dependent on the width of the widest OPTION item in the list; the width of the SELECT list will basically be not much greater (but no less) than this width.

The HTML standards don't allow for a way to control this width. CSS, on the other hand, would be perfect for controlling this, but historical support for CSS on form controls is rather weak.

Solution

Since Netscape 4 has only the proprietary attribute that will give the desired effect, it will not hurt anything to combine the use of CSS and the WIDTH attribute.

[tweet]

Example

<select name="foo" width="300" style="width: 300px">
<option>one </option>
<option>two </option>
<option>three </option>
</select>

SOURCE

LINK (blooberry.com)

LANGUAGE
ENGLISH