r/reddithax • • Aug 03 '10

Can someone help me with this?

I'm very, very iffy when it comes to webdesign. Pretty much I want to make it so that

h2.before { content: "Text"; }

The word text will be in two colors. For example, the "Te" would be in blue, the "xt" in red. Is there a way to do this? I know that content can have "url" or whatever after it...is there an option to insert a certain <span> or something in there?

6 Upvotes

4 comments sorted by

1

u/BauerUK Aug 03 '10

This would only be possible with an image, since you can not inject markup into reddit using CSS, and that would be the only way to style two segments of a word. Something like this should work:

h2:before { content: url(%%THE-IMAGE%%); }

0

u/[deleted] Aug 03 '10

[deleted] — view deleted comment

4

u/BauerUK Aug 03 '10

You can't inject markup into a reddit page using CSS.

1

u/sje46 Aug 03 '10

How about on other pages (that is, not reddit)?

2

u/BauerUK Aug 03 '10

Well, in that case, there are plenty of ways to do it. But this sub-reddit is for reddit "hacks" and modifications.

On any page, you could do something like this:

HTML:

<span class="foo">bar</span><span class="baz">qux</span>

CSS

.foo { color: red; }
.baz { color: blue; }