【问题标题】:CSS- Password field height in Mobile Safari and ChromeCSS-Mobile Safari 和 Chrome 中的密码字段高度
【发布时间】: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


【解决方案1】:

您可能必须为所有边添加显式填充,而不仅仅是 padding-left:

#logonForm input[type=text], #logonForm input[type=password] { 
    font-size:18px;
    border-radius:8px;
    padding:0 0 0 10px;
    height:22px;
    width:364px;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 2015-05-07
    • 1970-01-01
    • 2018-01-26
    • 2010-09-19
    • 2014-08-28
    • 2015-11-27
    相关资源
    最近更新 更多