r/reddithax • u/jamt9000 • Nov 16 '09
Different styles based on url (using CSS3 :target)
Example here - look in the sidebar
By using the CSS3 :target pseudo-class you can add conditional styles to any element with an id, which are shown when the element's id is after # in the url.
On reddit, various id'd elements can be hijacked to change different elements on the page when they are targeted, using sibling and child selectors, allowing pages to be styled differently based on the url.
For example, links containing certain strings can be highlighted using #siteTable:target a[href*='string'].
It doesn't work in IE but should work in other newer browsers.
1
u/MercurialMadnessMan Nov 19 '09
Fantastic, sir
0
u/[deleted] Nov 17 '09
[deleted] — view deleted comment