Search code examples
htmlcsstextboxpasswordbox

how to fix the size of password input field?


my html code is

<tr>
                <td>User ID:</td>
                <td><input type="text" id="uid" size="20"></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type="password" id="pass" size="20"></td>
            </tr>
            <tr>

but the problem is, password textbox length is coming diffrent in IE, means uid size is 20 but pass size is around 17.


Solution

  • Try using style="width:200px" for example rather than specifying size that way.

    <input type="text" id="uid" style="width:200px;">
    <input type="password" id="pass" style="width:200px;">
    

    Or you can create a class in the CSS like this:

    .input{
      width:200px;
    }
    

    And use like this:

    <input type="text" id="uid" class="input">
    <input type="password" id="pass" class="input">