css - 使用 CSS 设计密码输入字段

标签 css

我就是想不通。我需要另一双眼睛。

我正在尝试设置我的密码输入框的样式,使其看起来/ react 方式与我的文本输入框相同。

这是 HTML:

<fieldset class="contact">
    <label for="full_name">Purchasing Account ID:</label>
    <input type="text" id="acc_id" name="acc_id" size="13" />
    <label for="email_address">Email Address:</label>
    <input type="text" id="email_address" name="email_address" size="13" />
    <label for="password">Password:</label>
    <input type="password" id="pw" name="pw" size="13" />
</fieldset>

这是 CSS:

form input[type=text], form input[type=password] {
    width: 306px;
    background: #f3f3f3;
    border-top: 1px solid #dedede;
    border-left: 1px solid #dedede;
    border-right: 0;
    border-bottom: 0;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    padding: 10px 10px;
    font-size: 12px;
    color: #373737;
    -moz-box-shadow:inset 3px 3px 5px #e9e9e9;
    -webkit-box-shadow:inset 3px 3px 5px #e9e9e9;
    box-shadow:inset 3px 3px 5px #e9e9e9;
}
form input[type=text]:focus, form input[type=password]:focus, form textarea:focus {
    border: 3px solid #c70000;
}

关于为什么密码输入字段根本没有获取 CSS 的任何想法?我用谷歌浏览器检查了它,CSS 根本没有应用到密码输入字段,Firebug 显示了同样的东西。

最佳答案

如果您尝试这种方法会怎么样? 向您的输入添加一个 css 类,然后通过这些类应用样式。

http://jsfiddle.net/zr6yB/

<fieldset class="contact">
    <label for="full_name">Purchasing Account ID:</label>
    <input type="text" id="acc_id" name="acc_id" size="13" class="input-generic" />
    <label for="email_address">Email Address:</label>
    <input type="text" id="email_address" name="email_address" size="13" class="input-generic" />
    <label for="password">Password:</label>
    <input type="password" id="pw" name="pw" size="13" class="input-generic" />
</fieldset>​

CSS(缩写)

.input-generic {
    width: 306px;
    ...etc...
}

关于css - 使用 CSS 设计密码输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10763528/

相关文章:

css 继承上面的样式

html - 为什么 box-shadow 看起来与过滤器 : drop-shadow 不同

javascript - 当主 url 没有改变但表格内容改变时解析网页

html - moz-border-radius 不适用于 firefox

asp.net - 在 ASP.net 中运行 CSS 文件中的代码

css - Internet Explorer margin css hack

javascript - 如何从 Chart.js 饼图中删除白色边框?

html - 在缩略图图像顶部显示一个按钮

css - 分列时使用 Flexbox 实现等高 "rows"

css - 对齐社交媒体图标并将它们放置在页面中央