I’ve known about
:target for a while and have always found it to be quiet useful, but I think with an added animation spin to it, it can be truly profitable 👍
The CSS pseudo-class,
:target, styles an element that’s been referred through the page’s URL by its id (with a preceding hash symbol, #) present at the end of the URL.
Let’s say in a page there’s an element with
id, “notes”, and we refer to it from the URL (like, example.com/index.html#notes), then a style can be applied to it at that time from CSS with
This sort of styling is preferred for navigations within a page, like from a subtitle-link in a Table of Contents to its corresponding subtitle on the same page.
For this, I’ve always used simple styles, well not always, but never thought of including animations before.
Animating the targeted element adds a nice little touch to the navigation.