Home >Web Front-end >CSS Tutorial >How to Modify Button Appearance After It\'s Been Pressed Using the :target Pseudo-class?

How to Modify Button Appearance After It\'s Been Pressed Using the :target Pseudo-class?

Linda Hamilton
Linda HamiltonOriginal
2024-10-29 14:08:021048browse

How to Modify Button Appearance After It's Been Pressed Using the :target Pseudo-class?

"Pressed" Button Selector

When aiming to alter a button's appearance after it has been pressed, the conventional :active selector might not suffice. This selector only triggers when the button is physically held down.

To achieve the desired functionality, an alternative approach is to utilize the :target pseudo-class. This class activates when the corresponding anchor point (#btn in this case) is targeted.

Implementation:

Replace the

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn