Monday , February 3 2025

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 iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

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 *