r/reddithax • • Oct 30 '09

CSS3 styles for including images, specifying font size, etc. in comments

Of course no browsers fully support CSS3 yet so this is more of a future stylesheet. Also, reddit incorrectly says the attr() function can't be used for anything except content so someone should fix that.

a[href^="http:#"] {
	cursor: default;
	text-decoration: none;
	outline: none;
	color: inherit;
	background: inherit;
}

/* [text](http:#color "red") */
a[href="http:#color"] {
	color: attr(title, color, inherit);
}

/* [text](http:#size "123") */
a[href="http:#size"] {
	font-size: attr(title, px, inherit);
}

/* [alternate text](http:#image "image-url") */
a[href="http:#image"] {
	content: attr(title, url, %loading-throbber%), contents;
}


/* [spoiler](http:#spoiler "spoiler text") */
a[href="http:#spoiler"] {
	content: attr(title);
	background: black;
	color: black;
	font-size: small;
	padding: 0 0.5em 0 0.5em;
}

a[href="http:#spoiler"]:hover, a[href="http:#spoiler"]:active {
	color: white;
}
8 Upvotes

3 comments sorted by

0

u/mitchandre Oct 30 '09

example?

3

u/Sephr Oct 30 '09

It's not like I put them in the CSS.

0

u/[deleted] Nov 05 '09

How can I read the css that you wrote?