fail to change placeholder color with Bootstrap 3

前端 未结 10 847
暗喜
暗喜 2021-01-31 01:27

Two questions:

  1. I am trying to make the placeholder text white. But it doesn\'t work. I am using Bootstrap 3. JSFiddle demo

  2. Another question is h

10条回答
  •  太阳男子
    2021-01-31 02:03

    Assign the placeholder to a class selector like this:

    .form-control::-webkit-input-placeholder { color: white; }  /* WebKit, Blink, Edge */
    .form-control:-moz-placeholder { color: white; }  /* Mozilla Firefox 4 to 18 */
    .form-control::-moz-placeholder { color: white; }  /* Mozilla Firefox 19+ */
    .form-control:-ms-input-placeholder { color: white; }  /* Internet Explorer 10-11 */
    .form-control::-ms-input-placeholder { color: white; }  /* Microsoft Edge */
    

    It will work then since a stronger selector was probably overriding your global. I'm on a tablet so i cant inspect and confirm which stronger selector it was :) But it does work I tried it in your fiddle.

    This also answers your second question. By assigning it to a class or id and giving an input only that class you can control what inputs to style.

提交回复
热议问题