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

发布于 2024-09-12 07:25:23 字数 542 浏览 2 评论 0原文

我的 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 大小为 20pass 大小大约17

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感悟人生的甜 2024-09-19 07:25:23

例如,尝试使用 style="width:200px" 而不是以这种方式指定大小。


<输入类型=“密码”id=“密码”样式=“宽度:200px;”>

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

.input{
  width:200px;
}

并使用如下:

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

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">
对你而言 2024-09-19 07:25:23

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

在 CSS 文件中:

input {
  width: 150px;
}

或在内联 CSS 中: style="width: 150px;"

编辑:烤:)。

You can fix it with width: 150px; (with CSS).

In CSS file :

input {
  width: 150px;
}

Or in inline CSS : style="width: 150px;" .

Edit : Grilled :) .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文