![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||
| |||||
|
|
Any way to define the length of a textfield? |
|
I have just set all the field with a width so that they look like clear and easy to read, |
|
However, When I see the page of mac os, They are totally not the result in IE of FF, |
|
Does there any way to define it absolutely? |
|
I have already change the size attribute and set the width of the input. |
#3
| |||
| |||
|
|
Any way to define the length of a textfield? |
#4
| |||
| |||
|
|
Any way to define the length of a textfield? Like this: <input type="text" width=40 ...[the rest goes here] I expect this is what the OP did and that is where the problem lies. What I did was define a CSS class that made the textfields use a monospace font. Then the lengths are consistent always, determined by the width attribute in the input tag. An alternate method is to set the width in CSS using px, or ems to have |
#5
| |||
| |||
|
|
The size attribute should always be set for a text input field. Setting the width property in CSS tends to override that setting when CSS is enabled, but why would you do that? You normally don't have more suitable units in CSS than the implied unit used in HTML. Sometimes setting width="100%" is a good choice, though. |
#6
| |||
| |||
|
|
axlq wrote: What I did was define a CSS class that made the textfields use a monospace font. Then the lengths are consistent always, determined by the width attribute in the input tag. An alternate method is to set the width in CSS using px, or ems to have it adapt to font size. This is consistent across browsers regardless of font choice. .input-width { width: 12em; } |
#7
| |||||
| |||||
|
|
Like this: <input type="text" width=40 ...[the rest goes here] |
|
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. |
|
What I did was define a CSS class that made the textfields use a monospace font. |
|
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. |
|
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. |
#8
| |||||||
| |||||||
|
|
axlq <axlq (AT) spamcop (DOT) net> scripsit: 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 <input> element. What's worse, if some |
|
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. |
|
Courier is a bitmap font that isn't used that much. |
|
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>, <code> etc. |
|
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.) |
#9
| |||
| |||
|
|
.input-width { width: 12em; } That doesn't work as well for me, because an "em" unit isn't consistent across browsers, and an "em" unit has little or nothing to do with actual character width. True. It is based on character height. See |
![]() |
| Thread Tools | |
| Display Modes | |
| |