如何修复密码输入字段的大小?

nec*_*tar 3 html css textbox passwordbox

我的HTML代码是

<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>
Run Code Online (Sandbox Code Playgroud)

但问题是,密码文本框的长度在IE中变得不同,意味着uid大小20只是pass大小17.

Sar*_*raz 8

尝试使用style="width:200px"例如而不是指定大小.

<input type="text" id="uid" style="width:200px;">
<input type="password" id="pass" style="width:200px;">
Run Code Online (Sandbox Code Playgroud)

或者您可以在CSS中创建一个类,如下所示:

.input{
  width:200px;
}
Run Code Online (Sandbox Code Playgroud)

并使用这样的:

<input type="text" id="uid" class="input">
<input type="password" id="pass" class="input">
Run Code Online (Sandbox Code Playgroud)