The :target way
Clicking on the link below will change the URL by adding a hashtag to it. The element with the same ID will match the :target pseudo-class and become red.
Removing the hashtag in the URL, clicking another link or reloading the page are the only ways to restore the default state of the element.