简体   繁体   中英

Select header-tag (e.g. <h2>) with specific text in CSS

I have a question that I can't figure out after researching for a while:

I have <h2> -tags in my wordpress-blogs, and if they have a specific text (like <h2>Solution</h2> ) I would like to add a specific icon in front of them.

But how do I select this, only using CSS? I read a lot of posts that say it is not possible - but then I found out about xpath, but I didn't see an example how this would be possible.

I would need a "hint" in the right direction. Thanks!

To locate the elements with XPath, you can go with:

//h2[text()="Solution"]

Meaning: look everywhere on the page for a h2 element containing the text "Solution".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM