Topic: Change the form input control indicator color on focus
Marta Szymanska staff pro premium answered 8 years ago
input[type=text]:focus:not([readonly]) + label {
color: green;
}
input[type=text]:focus:not([readonly]) {
border-bottom: 1px solid green;
box-shadow: 0 1px 0 0 green;
}
Of course, you can change green
to any hex color you wish.
Best,
Marta devtrix pro answered 8 years ago
paolo.guerra answered 7 years ago
David Schartner answered 5 years ago
Hi,
how can I change the icon color as well?
<div class="md-form form-sm"> <i class="fas fa-user prefix"></i>
<input type="text" id="form3" class="form-control form-control-sm">
<label for="form3">Your name</label>
</div>
Thanks for help.
David
Krzysztof Wilk staff commented 5 years ago
Hi!
About changing icon color you can read here: https://mdbootstrap.com/docs/react/content/icons-usage/
All you have to do is add class with your color, for example .amber-text
or .orange-text
:)
Pasha Pshenishnyuk answered 5 years ago
Hi! How can i change icon color when input is focused?
MDBInput name="email" label="Эл. почта" icon="envelope" type="email"
I've changed border color, and i also need to change icon color
siddagz commented 3 years ago
Try this, in scss
.md-form label.active { color: black !important; }
.md-form .prefix.active { color: blue !important; }
Hi, u said you changed the border color, can help me on that?
Marcin Luczak staff commented 3 years ago
Hi @siddagz,
Depending on which version of the MDB you want to use you can try these styles for changing the border of the input:For MDB4 (jquery version):
.md-form input:focus { border-bottom: 1px solid red !important; box-shadow: 0 1px 0 0 #f76363 !important; // you can here use any reddish color or just use 'none' to disable any box-shadow}
.md-form label.active { color: red !important;}
For MDB5 (standard non jquery version):
.form-control:focus ~ .form-label{ color: red !important;}
.form-control:focus ~ .form-notch div { border-color: red !important;}
Keep coding, Marcin
Tomek Makowski staff answered 5 years ago
Hi
Just try to use input:focus {} ~ i
pseudo class in your css rules
Regards
Tomek Makowski staff answered 5 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No