25

How can I change the Placeholder Color in Bootstrap?

The following code, which I tried, doesn't work.

input::-webkit-input-placeholder {
        color: red;
}

input:-moz-placeholder {
        color: red;
}
2
  • 1
    I think you need to overwrite it with !important, something like color: red !important;
    – executable
    Commented Jul 12, 2018 at 6:57
  • Try inspecting the CSS in your browser. You'll see what CSS has highest priority, then you can add more selectors to your code to have your CSS get higher priority. Or use !important.
    – maxpaj
    Commented Jul 12, 2018 at 7:03

5 Answers 5

46
.form-control::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
            color: red;
            opacity: 1; /* Firefox */
}

.form-control:-ms-input-placeholder { /* Internet Explorer 10-11 */
            color: red;
}

.form-control::-ms-input-placeholder { /* Microsoft Edge */
            color: red;
 }

The following is the reference link. https://www.w3schools.com/howto/howto_css_placeholder.asp

1
  • 1
    just little update more color: red !important; Commented Oct 28, 2020 at 8:40
17

For Bootstrap 4, if you're using SCSS, just override variable $input-placeholder-color before you import bootstrap.

// variable overrides
$input-placeholder-color: red;

// Bootstrap and its default variables
@import "../node_modules/bootstrap/scss/bootstrap";
3
9

In Bootstrap 4 you change it like this:

.form-control::-webkit-input-placeholder {
  color: red;
}
3
  • but use !important as well Commented Jul 17, 2019 at 13:41
  • 2
    Probably best to work with bootstraps styling system, rather than overriding it with unknown interactions, as per stackoverflow.com/a/60809492/1880657.
    – Mark
    Commented Jun 19, 2020 at 1:16
  • Works in BS 4.5
    – hubert17
    Commented Jun 24, 2023 at 17:34
3

It's work for me in bootstrap 5.3

input::placeholder {
    color: white !important;
}
input[type="text"]{
    padding-inline: 45px;
}
2

Try the !important keyword

.input::placeholder {
     color: red !important;
     opacity: 1;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.