You can absolutely use :focus to work with the keyboard, however active will be difficult.
:focus is applied when this element receives focus. For example, when a user clicks an input field with the mouse or selects this input field from a tab. Here is an example showing how the focus works; both with a tab and with a mouse. W3School Focus For More Information MDN: focus
However :active bit is different. it is applied on the timeline between the click of a mouse button and its release. This is difficult to achieve with the keyboard. Because there is no pressing and hold the enter key. When the user presses the enter button, a link will open. Here you can see an example of work :active . W3School Active For More Information MDN: Active
If you intend to use pseudo-classes for links, I would suggest using :focus , it will do the trick for both the mouse and the tab key.
source share