Finding a tag by its text using css

How can you get the next tag using CSS ?

<p>You can only use the text inside the tag</p>

      

As with xpath, I would use the following:

//p[contains(text(), "inside the tag")

      

PS: I cannot close the xpath, it tries to autocompost with the code ...: S

+1


a source to share


2 answers


That's what I was looking for!



p:contains("inside the tag")

      

+3


a source


I believe that CSS3 selectors can only filter attributes and not text inside tags. So you can do something like a[href~="aspx"]

to map links to aspx pages, but as far as content compatibility is concerned.

For what you want to do, you probably have to use javascript or server side processing.



Have a look at quirksmode and W3 for more information.

+4


a source







All Articles