Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Location
    Central Texas Region
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Character Specific CSS?

    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 "_"?


    TIA
    Spiderman
    slinging web with every keystroke. . .

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Oct 2002
    Location
    Central Texas Region
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The info is fed from a database so the span tag idea won't work.

    Thanks anyways. . .
    Spiderman
    slinging web with every keystroke. . .

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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?

  • #5
    New to the CF scene
    Join Date
    Oct 2002
    Location
    Central Texas Region
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was chasing this problem on a different thread last week:

    See Thread Here

    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.

    <EDIT>
    Click here for an example of the end result (please excuse the broken images as I am outputing to a test folder).
    </EDIT>
    Last edited by spiderman; 10-14-2002 at 09:30 PM.
    Spiderman
    slinging web with every keystroke. . .

  • #6
    New Coder
    Join Date
    Jul 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Put this at the end of your page.

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

  • #7
    New to the CF scene
    Join Date
    Oct 2002
    Location
    Central Texas Region
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up




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

    Best Regards,
    Spiderman
    slinging web with every keystroke. . .


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •