Connecting Tech Pros Worldwide Help | Site Map

Can I set the width of my textbook to be this long, but no longer?

laredotornado@zipmail.com
Guest
 
Posts: n/a
#1: Jan 31 '07
Hi,

Say I have this textbox

<input "readonly" type="text" class="productName" value="<!-- could be
anything here -->" id="Name1" name="Name1">

How (if at all) can I define the class "productName" to make the width
of the textbox long enough to display all of the value of the textbox,
but then not take up any unnecessary space? For example, setting
width=100% may create a lot of extra space.

THanks, - Dave

Jukka K. Korpela
Guest
 
Posts: n/a
#2: Feb 1 '07

re: Can I set the width of my textbook to be this long, but no longer?


Scripsit laredotornado@zipmail.com:
Quote:
Say I have this textbox
In your Subject you called it textbook. Please type more carefully in
future.
Quote:
<input "readonly" type="text" class="productName" value="<!-- could be
anything here -->" id="Name1" name="Name1">
>
How (if at all) can I define the class "productName" to make the width
of the textbox long enough to display all of the value of the textbox,
but then not take up any unnecessary space?
Hardly. Form fields are typically implemented by system routines that have
idiosyncratic features that might be immune to any CSS code.

But why would you use such an element in the first place? If it's static
data to be included into the form set and to be shown to the user, express
this separately, e.g.

<span class="productName">foo bar</span>
<input type="hidden" name="Name1" value="foo bar">

You can then style the <spanas desired (or leave it unstyled - by default,
it occupies its natural width automatically).

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Closed Thread