Ask Your Question
2

Does a CSS selector exist for identifying elements that have specific text?

asked 2023-07-09 22:36:09 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-09 23:04:02 +0000

huitzilopochtli gravatar image

Yes, the CSS selector for identifying elements that have specific text is the "contains" selector. It is written as follows:

selector[attribute*=value]

where "selector" is any valid CSS selector, "attribute" is the name of the attribute containing the text, and "value" is the specific text to search for. For example:

p:contains("Lorem ipsum")

This selector will match all paragraphs that contain the text "Lorem ipsum".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-09 22:36:09 +0000

Seen: 7 times

Last updated: Jul 09 '23