Forum Moderators: not2easy
The code in question is as follows:
Username <input type="text" size="20" name="username" />
Password <input type="password" size="20" name="password" />
On Firefox and Opera 7, this form shows up fine. IE6 however displays the text fields as having different lengths, even though their 'size' attribute is the same. Anyone know why? The 'username' field is about ten pixels longer.
I got round this by casting the <input> tags to block display type, and then assigning them the same width (80%), which did the trick, but I don't really want to block-display the text fields.. Any chance it can be done some other way?
Thanks in advance for any help,
Alex ...
Do we know why IE does that, by the way?
Does it do so consistently? I tried your example and had no problems in IE6 (both were the same width). Is there perhaps some other element in the form, or something else in the surrounding code constricting the overall width of the form or block the input boxes are located in?
and DTD doesn't seem to have an effect here.. but the <meta charset> does?
I had started testing further because I hadn't noticed but in my test it was actually the password box that was longer, whereas Warboss_Alex said it was the username
try this code and uncomment the meta tags one at a time..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Untitled</title>
<!--
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
-->
<!--
<meta http-equiv="content-type" content="text/html; UTF-8" />
-->
<style type="text/css" media="screen">
input {
border: 1px solid red;
font-size: 12px;
/* font-family: arial; */
}</style>
</head>
<body>
<input type="text" size="20" name="username" /><br />
<input type="password" size="20" name="password" />
</body>
</html>
The cure of re-defining a font-family seems to be the same regardless of whether you've already declared it in the body element or not.
don't thing I ever came across anythign that the charset affected before?
Suzy
[added] I had connection problems and didn't see the DTD replies in between times ;)
but.. I did try this test with different/no Doctypes and the results were the same..[/added]