Where to find input placeholder style

前端 未结 4 1542
[愿得一人]
[愿得一人] 2021-01-17 20:34

Couldn\'t find default placeholder style for input element. There are no any webkit-input-placeholder, -moz-placeholder, -moz-placeholder

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 21:08

    To style the place holders you should use vendor-prefixed selectors

    ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
      color: pink;
    }
    ::-moz-placeholder { /* Firefox 19+ */
      color: pink;
    }
    :-ms-input-placeholder { /* IE 10+ */
      color: pink;
    }
    :-moz-placeholder { /* Firefox 18- */
      color: pink;
    }
    

    You can even scope the elements,

    input[type="email"].user_email::-webkit-input-placeholder {
      color: blue;
    }
    

    Please refer this answer, Different place holder implementations and usage

提交回复
热议问题