Remove the Blue Border from Custom-Styled Buttons in Chrome
When customizing the appearance of
The Problem:
The default browser styles may override some CSS properties, including those related to focus and active states. In Chrome, buttons have a blue focus outline when clicked, even when border: none is set.
Solution:
Note: Removing focus outlines is not recommended as it can affect accessibility.
If you still wish to hide the blue border, add the following CSS rule:
button:focus { outline: 0; }
This rule explicitly removes the focus outline, overriding the default browser behavior.
Explanation:
The :focus pseudo-class is triggered when an element receives focus (usually by clicking or tabbing). By setting outline: 0;, you eliminate the blue border associated with that focused state.
Alternative Solutions:
Additional Considerations:
Reference:
The above is the detailed content of How to Remove the Annoying Blue Border from Buttons in Chrome?. For more information, please follow other related articles on the PHP Chinese website!