Using CSS To Color Certain Characters

Sitepoint Members,
Is there a way to use CSS to color a specific character whereever it appears without doing anything in HTML to prompt the coloring (w/o span)?

Thanks,

Chris

No, not without some kind of styling hook like a span. You can do it with JS, though.

I am sorry to say , no. CSS styles elements and individual characters aren’t elements; they are one could say a ‘property’ of an element.

Besides, it really doesnt go with what CSS does. If all the letter Es are supposed to be red for some reason… then that reason should be reflected in the markup. Otherwise that what Span is there for, specifically… to HOOK CSS

Keep in mind tho , tho you aren’t necessarily restricted to using SPAN. There are other presentational elements still around, such and I and B, which you could use to exclusively wrap a charter.

I’ll have to modify that wish and do it just for the first quote in a page and use span or others.

I have a php file that directs all the html files. Is there a way to do it in php?

Chris

Depends on what you want to do in PHP. The question is not very specific. But ultimately the styling will be handled by CSS in some fashion, because the PHP is gone by the time the page gets to the browser.