Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | CSS | Q1787 [ previous next ]

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

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.