Friday, February 28, 2020

CSS Code to Remove Border (Outline) Around Text / Input Boxes on Focus

This border is used to show that the element is focused (i.e. you can type in the input or click the button with Enter key).

You can remove it, though:

textarea:focus, input:focus {
    outline: none;
}

Chrome browser will also apply highlighting to other elements such as DIV's used as modals.

To prevent the highlight on those and all other elements as well, you can do:

*:focus {
    outline: none;
}

No comments:

Post a Comment