3 ms·
Using a fragment identifier (the thing after #) and a :target selector means people can link to a particular tab, browser history can reflect changing tab, and
by TazeTSchnitzel 10y ago
Using a fragment identifier (the thing after #) and a :target selector means people can link to a particular tab, browser history can reflect changing tab, and the link will work without CSS and be accessible.
- pimterry 10y agoI really like :target too, but if you have a page longer than your browser it always jumps you down to the tab you've just opened, a bit annoyingly. The rest of the built-in behaviour of :target is way nicer though, and the HTML & CSS is really clean. I've actually just spent a little while this afternoon playing with this, since it is so much better. I've got a nice new workaround that'll make this work nicely if you'd prefer to use :target too: https://medium.com/@pimterry/better-css-only-tabs-with-target-7886c88deb75#.j4e9hfot1 https://medium.com/@pimterry/better-css-only-tabs-with-targe...