【发布时间】:2013-03-14 21:36:39
【问题描述】:
即使我将 style="height:22px" 直接应用于这两个元素,我也遇到了密码字段的高度与其上方的文本字段不同的问题。
当前 HTML:
<h2>Username
<label>
<input name="email" type="text" id="email" style="height:22px" />
</label>
</h2>
<h2>Password
<label>
<input name="password" type="password" id="password"style="height:22px" />
</label>
</h2>
当前的 CSS:
#logonForm input[type=text], #logonForm input[type=password] {
font-size:18px;
border-radius:8px;
padding-left:10px;
height:22px;
width:364px;
}
这呈现(带有或不带有样式属性)为
如何使它呈现为相同的高度,为什么会出现这种情况?
【问题讨论】:
-
属性之间需要一个空格:
id="password" style="height:22px" -
@Steve - 已添加;没有变化
-
@Adrift 添加到样式表; refresh 没有显示变化,但不知道如何在移动浏览器上强制硬刷新。
-
您是否尝试过在 CSS 中添加明确的
line-height? -
OK 所以当前样式是
#logonForm input[type=text], #logonForm input[type=password] { font-size:18px; border-radius:8px; padding-left:10px; height:initial; line-height:22px; width:364px; -webkit-appearance: none; }已清除 Safari 缓存但显示没有变化;还从 html 中删除了 style 属性
标签: css mobile-safari mobile-chrome