Hacker News new | past | comments | ask | show | jobs | submit login

The checkbox hack can be replaced with :active in many cases.



:active is completely different and never a suitable replacement for the checkbox hack: it only ever matches while the primary mouse button is being held down, and is keyboard-inaccessible; the checkbox hack is about toggling state on click or key stroke.


Oops, I meant :target.


:target is dubious at best: it messes with your scroll position, and you can only use it for one thing in a document.

Historically it was also rather buggy in most browsers, though hopefully that’s sorted out now. (A decade ago, Firefox was fine, but IE and Chromium both had significant bugs, might have been to do with back/forward not recalculating :target or something like that. When I last seriously used :target in 2016 or so, on a multipage-in-one-document résumé, I think they were down to fairly minor bugs.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: