【问题标题】:vertical align placeholder in ieie中的垂直对齐占位符
【发布时间】:2019-04-09 02:44:43
【问题描述】:

有人可以帮我解决 IE 中占位符的垂直对齐问题吗?我固定在其他浏览器上,使用 transform: translateY(3px); 看起来不错不幸的是,html 来自我的时事通讯提供商的一个小部件,所以我无法更改它,我只能访问 css 样式。

如果可能的话,我希望复选框在 IE 中看起来也一样,它看起来像 -webkit-appearance: none;不适用于ie。 非常感谢

HTML

<input type="hidden" name="wpmailup-subscribe" class="wpmailup-subscribe" value="subscribe">
<fieldset class="subscribeDataTable">
  <h4 class="widgettitle">Iscriviti alla nostra newsletter!</h4>
  <p class="muDescription"></p>
  <p class="muField">
     <input type="text" name="sub-email" class="sub-email" placeholder="Email*">
  </p>
  <p class="muField">
     <input type="text" name="sub-ext1" class="sub-ext1" maxlength="80" placeholder="Nome*">
  </p>
  <p class="muTermsCheckbox">
     <label><input name="terms-confirm" class="terms-confirm" type="checkbox" value="yes"> Accetto l'informativa sulla <a class="ppaccept" href="/privacy-policy"></a></label>
  </p>
  </span>
  <p class="muSubmit"><input type="submit" name="submit" value="iscriviti!"></p>
</fieldset>

CSS

.subscribeForm input {
  border-width: 1px;
  border-style: solid;
  border-color: #ffd300;
  padding: 16px;
  line-height: 2em;
  font-size: 16px;
}

【问题讨论】:

    标签: css placeholder


    【解决方案1】:

    您在输入中设置了line-height: 2em;,这在不同的浏览器中计算方式不同。删除此行,您应该会看到占位符在 IE 和 Chrome/其他现代浏览器上垂直对齐。

    .subscribeForm input {
      border-width: 1px;
      border-style: solid;
      border-color: #ffd300;
      padding: 16px;
      /* line-height: 2em; */
    }
    

    编辑:

    关于appearance 问题,-webkit-appearancevendor prefix

    通过将代码切换为:

    input {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    

    这将确保它适用于所有浏览器。请注意 Edge 和 IE handle prefixing differently

    【讨论】:

    • 不,我的朋友,我已经尝试过了,但没有成功,考虑到占位符是通过 ::placeholder 伪元素设置的,如果您不启用显示用户,则无法在 chrome 检查器中检查它chrome 设置中的代理影子 DOM
    • 它有效。 screenshot.。占位符文本行高不会与输入文本行高不同。
    • 好的,我会在几个小时后尝试,我会发布结果,抱歉,但在这个特殊的时刻我不在办公室.. 无论如何,非常感谢你,希望你能解决这个问题
    • 如果这不是您要查找的内容,那么我可能会等到您上传了代码 sn-p 以更好地了解您要查找的内容。跨度>
    • 我的朋友,您的简单建议解决了我的问题,我之前没有注意到行高!如果您对修复 -webkit-appearance: none; 有其他建议,请告诉我。我已应用于复选框,因为它不适用于 ie 并且我无法设置复选框的样式,其他浏览器也可以!
    猜你喜欢
    • 1970-01-01
    • 2016-07-25
    • 2018-07-19
    • 2010-12-01
    • 2020-10-25
    • 2012-10-22
    • 2022-11-22
    • 2019-05-24
    • 2011-05-24
    相关资源
    最近更新 更多