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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    format paragraph containing a custom word

    I'm trying to add some css tags (<strong>, <em> etc) to an entire paragraph <p> that contains a custom word, for example a paragraph like this <p>Title:....</p>

    This could be easily done for the custom word only with a var.str and document write. I would be grateful if you could post the entire code.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    This can be done in CSS with the ":contains" pseudo-class

    Code:
    p:contains("Title:") {
       background-color: yellow;
    }


  •  

    Tags for this Thread

    Posting Permissions

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