【问题标题】:How to change placeholder font如何更改占位符字体
【发布时间】:2019-04-01 20:22:50
【问题描述】:

我目前正在尝试更改我的用户 ID 和密码字段的占位符的字体。我在下面添加了 css,它更改了用户 ID 占位符字体,但没有更改密码占位符字体,我不知道为什么。

有什么帮助吗?

::-webkit-input-placeholder { /* Chrome/Opera/Safari */
  font-family: 'helveticaneueregular', sans-serif !important;
}
::-moz-placeholder { /* Firefox 19+ */
      font-family: 'helveticaneueregular', sans-serif !important;
}
:-ms-input-placeholder { /* IE 10+ */
      font-family: 'helveticaneueregular', sans-serif !important;
}
:-moz-placeholder { /* Firefox 18- */
      font-family: 'helveticaneueregular', sans-serif !important;
}
	<input style="font-family: 'helveticaneueregular', sans-serif !important;" type="text" id="username" name="username" role="textbox" class="rememberMainField txt15 commonFont1Style2 clearTextField" placeholder="User ID" required="" autocapitalize="off" autocomplete="off" autocorrect="off" aria-label="Enter Your User ID" maxlength="50" minlength="3" pattern="^[^ ]+$" relinputid="RelativeClass0">

【问题讨论】:

标签: css


【解决方案1】:

更多信息?在这个例子中它适用于两者:

.font1::-webkit-input-placeholder {
    font-family: "Times New Roman", Times, serif;
    background-color: yellow;
}

.font2::-webkit-input-placeholder { 
    font-family: Arial, Helvetica, sans-serif;
    background-color: pink;
}
Times New Roman placeholder font:<br/>
<input class="font1" placeholder="User ID">
<input class="font1" type="password" placeholder="Password">
<br/><br/>
Arial placeholder font:<br/>
<input class="font2" placeholder="User ID" >
<input class="font2" type="password" placeholder="Password">

【讨论】:

    猜你喜欢
    • 2020-07-21
    • 2019-05-23
    • 2013-01-09
    • 2016-07-26
    • 1970-01-01
    • 2020-08-22
    • 2016-06-12
    • 2020-02-12
    • 2014-06-12
    相关资源
    最近更新 更多