Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1787 How can I specify the width of a form select field?

You are here: irt.org | FAQ | CSS | Q1787 [ previous next ]

You can conditionally specify the width of a select (drop down) box in both IE and NN4+ at the same time. Each will ignore the other. For IE use a style specifying the width in pixels. The same width you give IE in pixels use for NN4+ as a width attribute in the select tag. The following example will render a select box which displays the same width in both IE and NN although if your elements of the select box use more chars than are available for display, NN will widen the box where IE will truncate the text of the element.

<select name=category style="width: 260px; font: 9pt Verdana, Tahoma, Arial, Helvetica;" width="256">
<option value="General Comment">General Comment
<option value="Seller Question">Seller Question
<option value="Buyer Question">Buyer Question
<option value="Damaged Shipment">Damaged Shipment
<option value="Employment">Employment
</select>

Submitted by Dave

©2018 Martin Webb