Text field with size of one in IE

In Firefox, it’s very easy to set the attribute of size to 1 for a text field. But in IE, even the size is 1, it still takes a lot of space in the page. One simple solution but not perfect is to set the style of width, e.g. style=“width: 10px”. You will need to tweak it a little bit in order to find a good width for your web pages. :(

Below are the code:

<pre> <input type="text" size="1" maxlength="1" value="1"></input> <!-- This works well in Firefox, but not IE --> <input type="text" size="1" maxlength="1" value="1" style="width: 10px"></input> <!-- This works well in Firefox and IE --> </pre>

Posted by Shaokun 06 Nov 2008 at 09:25PM



>