View Full Version : Character Specific CSS?

10-14-2002, 06:02 PM
I have a page that displays underscores in between some words.

The background is black and the text is white.

Is there a way (using CSS) that I can tell all of the underscores to be black so that it appears to be a space instead of a "_"?


10-14-2002, 07:25 PM
Not without eliminating the advantages of using CSS.

CSS styles elements, not text nodes.

You'd have to surround every "_" in some sort of tag, probably a <span>, and do it that way.

10-14-2002, 08:52 PM
:( The info is fed from a database so the span tag idea won't work.

Thanks anyways. . .

10-14-2002, 08:59 PM
If it's coming from a DB, why not do a search for the _ in the results and then add the span tags around it? Or why not edit it before it goes into the DB?

10-14-2002, 09:20 PM
I was chasing this problem on a different thread last week:

See Thread Here (http://www.codingforums.com/showthread.php?s=&threadid=7767)

The reason that I inserted the _'s was to make the JS work correctly (which it now does). Now I want to fix the page display so that the _'s are invisible.

Click here (http://www.kwtx.com/sports/sports_friday/sf_scores/test/) for an example of the end result (please excuse the broken images as I am outputing to a test folder).

10-14-2002, 10:25 PM
Put this at the end of your page.

<script language="JavaScript" type="text/javascript">
var range = document.body.createTextRange();
while (range.findText("_")) {
range.text=" ";

10-15-2002, 04:39 PM

Thank You! That worked great! I really appreciate it Pooh

Best Regards,