Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder Color Change in Bootstrap

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;
}
like image 800
Faizan Butt Avatar asked Jul 12 '18 06:07

Faizan Butt


3 Answers

.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

like image 93
Asraf Avatar answered Nov 14 '22 19:11

Asraf


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";
like image 30
yimei Avatar answered Nov 14 '22 18:11

yimei


In Bootstrap 4 you change it like this:

.form-control::-webkit-input-placeholder {
  color: red;
}
like image 8
Claudio Oliva Avatar answered Nov 14 '22 20:11

Claudio Oliva