axlq <ax**@spamcop.n etscripsit:
Like this: <input type="text" width=40 ...[the rest goes here]>
Why would you use invalid markup, instead of using the size attribute? The
width attribute is undefined in an <inputelement . What's worse, if some
browsers recognize it, who knows how they will treat it? They might use 40
pixels, or 40 characters, or something else.
I had a problem with a user ID textfield and a password textfield
appeared the same width in one browser but different widths in
another browser.
Quite catastrophic, is it not? Surely typical users viewed your page on both
browsers and were shocked at the different widths.
What I did was define a CSS class that made the textfields use a
monospace font.
Well, that's an approach that may help in the problem, but we know that it
(when it works - remember the usual CSS caveats) _creates_ a problem: user
input (as well as any prefilled content) will appear in a monospace font.
This is not typical and normal, so it may make the user wonder what is going
on. The problem might be tolerable, but before creating it, I would ask:
what is the original problem, really, and how much does it matter?
About the monotext class: Lucida Console and Monaco are attractive
monospace fonts on Windows and Mac platforms, easier on the eyes
than the default Courier.
Courier is a bitmap font that isn't used that much. Is it still the default
somewhere? I'd say Courier New (which looks rather similar to Lucida
Console) is more common.
The font size attribute is unnecessary
but I have found all the browsers I test seem to use a default
monospace size that looks bigger than the normal text.
Browsers generally use reduced font size for some elements, including
<input>, <codeetc. This is rather poorly documented and not a very good
idea. E.g., it is probably important that the user can see clearly the
characters he has typed. For <code>, the feature is understandable since
<codeis normally rendered in a monospace font, and this typically means
that it looks somewhat bigger than text in a proportional font with the same
font size.
So for <input>, I would rather treat the default size reduction as a problem
rather than as something I should imitate in my CSS code, so I normally use
font-size: 100% for input. Actually, on my computer, your suggested 91%
seems to make the font size _larger_ than without the setting (though not as
large as 100%), whereas 90% gives the default size. (This may sound odd, but
font size rounding effects can be odd.)
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/