Friday , December 20 2024

Color change for placeholder in input not working

By default, gray font is displayed, which does not blend well with a dark background. If in css it is easy to change the background for the input, then I had to find a solution for the text color in the placeholder.

This example helped me solve the problem (the input had the class form-control):

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

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

Css styles for WordPress admin in functions.php

If you need to add individual styles, and they are only a couple of lines, …

Leave a Reply

Your email address will not be published. Required fields are marked *