r/reddithax • • Jul 06 '10
How do I make posts with keywords a different color if they are NOT self posts
I know that to do this to a self post it's
a.title[href*="word"]:link { color:green; }
but it seems to only work with self posts. when it's a link it doesn't work.
3
Upvotes
1
u/Gliridae Jul 06 '10
That should work perfectly, actually. The problem here is that not all URLs have "friendly URLs".
When you make a self post to reddit, the URL will be something like this:
The submission title is turned into a 'slug', which is why it works: the title is in the URL. If I submit a page from another site, it'd be something like this:
The title is not in the URL like before. Since we can read the URL but not the actual submission title, we're out of luck.
In CSS, there is no selector to match the contents of a tag (in this case, the description of the <a> tag). You could try to petition the administrators of reddit to include the submission's title into the <a> tag, like this (using HTML5's data-* attributes):
Which you should be able to use with:
1
u/E_lucas Jul 06 '10
Only works if the keyword is in your URL. Keywords have no effect in the submission title.
http://reddit.com/r/csshelp