Click to See Complete Forum and Search --> : input type=text size parameter


Bostonrose
04-23-2003, 02:27 PM
I have an input field defined as <input type="text" SIZE="3" Maxlength="6" NAME="Loc1">. However, under IE5.5 it actually shows a box big enough for 5 numbers. If I change size to 1, the input box is 3 number size. Is there some minimum size to the input box that the "size" in the html is added to to get the final size? thanks, Bostonrose

khalidali63
04-23-2003, 02:31 PM
what do you mean??? liket he field do not take input ledd then 3 chars??

Bostonrose
04-23-2003, 02:37 PM
No, I just want the input box to be the size that fits the number of letters/numbers I need to put in it and thought the "size" would limit it and it doesn't. It's not a big problem, just wanted to understand the why's. Bostonrose.

khalidali63
04-23-2003, 03:09 PM
oh okkay..Its have a hack for this I alwasy use,,,
Use CSS property width and use pixels fro the size..

8 pixels is roughly = 1 characeter

so if you want your text field to be as wide as for 6 character length this what it should look like

<input type="text" Maxlength="6" name="Loc1" style="width:48px;">

This should bring you close to what you want....:D

And BTW try not using caps in attribute names it will cause problems in near future in browsers...

nkaisare
04-23-2003, 05:29 PM
Originally posted by khalidali63
<input type="text" Maxlength="6" name="Loc1" style="width:48px;">

And BTW try not using caps in attribute names it will cause problems in near future in browsers...

I beg to differ on both counts. Forms are not HTML level but system level controls. So the behavior will differ from system to system. If you want a pixel-perfect layout based on other stuff on your page, this may be a way to go. If you want it for some other reason, its best to leave it to the browser.

I don't know about the future, but browsers will not stop supporting valid HTML 4.01 in a hurry. small attributes and elements are required only in XHTML. Since XHTML is the future of the web -or so it seems- its a good idea to make it a habit of using small case. But its not required.

Bostonrose
04-23-2003, 05:36 PM
Thanks all for the info, I don't usually use caps for either, I'd just been playing with them, and accidentally the caps lock was on when I created it for sending here. Bostonrose.

khalidali63
04-23-2003, 05:43 PM
Originally posted by nkaisare
......its a good idea to make it a habit of using small case. But its not required.

Did I say anywhere that its required,I only mentioned it has potential of causing problems in future.

Sure difference is good,but its always better if a post does contain some additions or a new solution to the underlying problem...( and your post contains neither)