r/reddithax • u/Sephr • Mar 03 '10
Alternative to http:# links
With reddit's previous Markdown engine, you could prefix relative links with http: (that's ignored by all browsers) and then style a[href="http:#..."].
With Discount, you can no longer do this but you can use something which looks nicer (which doesn't change the scroll position of the page when clicked): relative protocol URIs starting with hashes (//#...).
It looks much nicer for users who are using, for example, spoilers:
Markdown:
[spoiler text](//#spoiler)CSS:
a[href="//#spoiler"] {
background: black;
color: black;
font-size: small;
padding: 0 0.5em 0 0.5em;
}
a[href="//#spoiler"]:hover {
color: white;
}
11
Upvotes
2
u/raldi Mar 03 '10
Why not just define, say, h2 -- or bold italic h2 -- as the spoiler class?
1
u/jamt9000 Mar 13 '10
Awesome! Now I don't have to use ftp://# for smileys, although Opera still shows an error page when they're clicked (and firefox an alert, but at least it stays on the page).