如何固定密码输入字段的大小?

问题描述 投票:0回答:3

我的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>

但问题是,密码文本框的长度在 IE 中有所不同,意味着

uid
大小为
20
pass
大小约为
17

html css textbox passwordbox
3个回答
8
投票

例如尝试使用

style="width:200px"
而不是以这种方式指定尺寸。

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

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

.input{
  width:200px;
}

并像这样使用:

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

1
投票

您可以使用

width: 150px;
(使用 CSS)修复它。

在 CSS 文件中:

input {
  width: 150px;
}

或者在内联 CSS 中:

style="width: 150px;"
.

编辑:烤:).


0
投票

以上方法无法解决问题。这是由 Google Chrome 的自动填充密码功能引起的,但我不知道如何解决。

© www.soinside.com 2019 - 2024. All rights reserved.