Skip to content
Advertisement

I styled focus state for my webpage. But even after I’m done clicking button/link, the focus stays, unless I click whitespaces. How do I make it go?

I’ve styled the focus state for my webpage to my liking. But now it stays on the buttons/links even when I’m done clicking them. I have to click the blank spaces to make it go away. I only want the focus state to be visible when we use TAB key for shifting focus, and(optional) when the buttons are clicked. How can I do that? Do I need to write some JavaScript for that? Basically I want the focus state to behave in a default way, the way it did before I styled it.

JavaScript

Advertisement

Answer

try using this css selector instead of *:focus

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement