LoginSignup
4
3

More than 5 years have passed since last update.

TextareaのPlaceholderのフォントがinput text のPlaceholder と異なる場合の対応方法

Posted at

すぐ確認できた環境で確認した結果

環境 input text textarea
Windows IE 10 親要素のfont-familyが適用 何も適用されない
Windows Chrome 親要素のfont-familyが適用 何も適用されない
Mac Safari 親要素のfont-familyが適用 親要素のfont-familyが適用
Mac Chrome 親要素のfont-familyが適用 親要素のfont-familyが適用

※valueのCSSではなく、親要素のfont-familyが適用された様子。

対応策

以下のようにして対応
::-webkit-input-placeholder{
    font-family: "Verdana",  sans-serif;
}
:-moz-placeholder {
    font-family: "Verdana",  sans-serif;
}

他にも指定できた要素として確認できたものは以下

  • padding
  • font-weight
  • font-color
  • line-height
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3