You can use CSS's pseudo-class
to do that. A pseudo-class is used to define a special state of an element.
there is a ::focus
pseudo-class that is used to select the element that has focus.
So you can hook it in your CSS like this
Using class
.my-input::focus {
outline-color: green;
}
_x000D_
Using Id
#my-input::focus {
outline-color: red;
}
_x000D_
Directly selecting element
input::focus {
outline-color: blue;
}
_x000D_
Using attribute selector
input[type="text"]::focus {
outline-color: orange;
}
_x000D_