[thelist] Setting Size (Length) of <OPTION> Tag

Jeff jeff at members.evolt.org
Mon Jun 19 18:47:05 2000


gregory,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: <Gregory.John.Toland@ccmail.census.gov>
:
: Is there a way of setting the size (length) of the <OPTION>
: tag within a <SELECT> section.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

yes with stylesheets, but only for ie4+.  all other browsers will simply
ignore it.

<select style="width: 100px">

beware if the content in the <option> is longer than the 100px though as it
will disappear off to the right with no way to read it.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I would like to "wrap" the text if possible so the
: SELECT...OPTION pull-down box does not scroll
: off to the right side of the screen.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

forcing a width won't force a line wrap.  when you consider how select boxes
work, one line equals one choice, it wouldn't make much sense of there was
wrapping.  it would be immediately confusing to the user whether a line was
part of the line above or it's own option.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Is my only option to shorten my <OPTION> tags?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

yes, unless you want to wrap the values yourself.  if you do, make sure to
assign the value attribute of the <option> tag the same value for all lines
the phrase spans.  that way, no matter which portion of the phrase they
happen to select, you will still get the correct value coming across when
the form is submitted.

<select>
  <option value="">Choose One</option>
  <option value="1">this</option>
  <option value="1">  is</option>
  <option value="1">  a</option>
  <option value="1">  wrapped</option>
  <option value="1">  option</option>
</select>

you should also come up with some way to identify a line as being the start
and the wrapped lines as being part of the start.

however, my vote for the sake of usability is to simply shorten your option
tags to options that are more concise.

good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff@members.evolt.org