The :active pseudo-class matches an element while the user is activating it— usually while the primary mouse button is held down or a finger is pressing.
It is most often used on <a> and <button>. It can also match nested content inside an activated element, and form controls activated through a linked <label>.
Note Not the “current page”
:active is only the press state. It does not mean “this is the active menu item.” Style the current page with a class or :target pattern instead.
Note LVHA order for links
Put link rules in this order: :link → :visited → :hover → :active, so the pressed style can override hover.
Syntax
CSS Syntax
syntax.css
selector:active{ /* styles while pressed */ }
No arguments. Pair it with an element or class selector, for example button:active or a:active.
The paragraph darkens while you hold the primary button.
How It Works
Style the box. Light gray is the resting look.
Target p:active. Any press on the paragraph matches.
Darken briefly. Shows that activation is not only for controls.
Prefer real controls. For accessibility, use buttons/links for actions.
Edge Cases & Pitfalls
Short-lived state—easy to miss if order or meaning is wrong.
myth
Not “current page”
Do not use :active to highlight the nav item for the page you are on. Use a class (or similar) for that.
order
Put :active after :hover
Otherwise equal-specificity hover rules can hide the pressed style on links.
mouse
Primary button only
CSS applies :active to the primary mouse button (usually the left button), not every mouse button.
touch
Brief on touch devices
The state can flash quickly on tap. Keep the change clear and avoid relying on it alone for critical feedback.
focus
Also style :focus / keyboard
Keyboard users need focus styles. Pair with :focus (and consider focus-visible patterns) for full interaction feedback.
Compatibility
Browser Support
:active is a browser CSS pseudo-class. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available
:active
Supported in all major browsers for decades (Baseline Widely available since about July 2015). Safe for everyday UI press feedback.
99%All modern browsers
Google ChromeAll
Full
Mozilla FirefoxAll
Full
Apple SafariAll
Full
Microsoft EdgeAll
Full
OperaAll
Full
Samsung InternetAll
Full
Internet ExplorerAll
Full
:activeUniversally supported
Bottom line: Production-ready. Remember LVHA order for links, and do not confuse :active with the current page.
Remember
Key Takeaways
Role: style the element while it is being pressed/activated.
Targets: buttons, links, and other activated elements.
Order: LVHA — put :active last for links.
Tip: not for current-page highlighting; keep keyboard :focus styles too.
One line::active is the brief pressed state—style it after :hover, and do not confuse it with the current page.
Frequently Asked Questions
It styles an element while the user is activating it—typically while the primary mouse button is held down or a finger is pressing.
No. That is a common myth. :active is only the press/activation state, not “this is the active menu item.”
:hover applies while the pointer is over the element. :active applies only during the press, before release.
For links, use LVHA order: :link, :visited, :hover, :active. Later rules with equal specificity win, so :active must be last to show while pressing.
Buttons and links are the usual targets. It can also match other elements being activated, nested content inside an active element, and controls activated via a linked label.
No. It is a browser CSS pseudo-class, not a Node.js feature.