If I read the specification correctly, no.

You can match on an element, the name of an attribute in the element, and the value of a named attribute in an element. I don't see anything for matching content within an element, though.

Answer from Dean J on Stack Overflow
🌐
W3Schools
w3schools.com › css › css_selectors.asp
CSS Selectors
CSS selectors are used to "find" (or select) the HTML elements you want to style.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Styling_basics › Basic_selectors
Basic CSS selectors - Learn web development | MDN
A type selector is sometimes called a tag name selector or element selector because it selects an HTML tag/element in your document. In the example below, we have used the span, em and strong selectors. Try editing the following example (click "Play" to open it in the MDN Playground) to add ...
🌐
GeeksforGeeks
geeksforgeeks.org › css › css-selectors
CSS Selectors - GeeksforGeeks
Basic selectors in CSS are simple ... all elements on the page and applies the same style universally. Example: Setting the font color for every element....
Published   1 week ago
🌐
Programiz
programiz.com › css › selectors
CSS Selectors (With Examples)
Here, the code applies CSS styling to all <h1> and <p> elements. Notice that we have used , to separate the HTML elements.. The attribute selector selects elements based on specific attribute values.
🌐
W3Schools
w3schools.com › cssref › css_selectors.php
CSS Selectors Reference
The attribute selector selects HTML elements with a given attribute set. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Guides › Selectors
CSS selectors - CSS | MDN
January 7, 2026 - The CSS selectors module defines the patterns to select elements to which a set of CSS rules are then applied along with their specificity. The CSS selectors module provides us with more than 60 selectors and five combinators. Other modules provide additional pseudo-class selectors and ...
🌐
BrowserStack
browserstack.com › home › guide › mastering selenium css selectors in 2026
CSS Selector in Selenium: Locate Elements with Examples | BrowserStack
December 10, 2025 - Explore CSS selectors in Selenium with clear examples and tips to locate elements accurately and build more stable, reliable test scripts.
Find elsewhere
🌐
CSS-Tricks
css-tricks.com › css-selectors
CSS Selectors | CSS-Tricks
May 2, 2025 - CSS nesting is a similar way that we can format CSS rulesets. We start with a parent ruleset and then embed descendant rulesets inside. So, if we were to select the <h2> element in that last HTML example, we might write a descendant selector like this:
🌐
SitePoint
sitepoint.com › blog › css › css selectors cheat sheet
CSS Selectors Cheat Sheet — SitePoint
November 13, 2024 - In this example, the selector will match all elements that have a class of box and that are immediate children of the #container element. That means, unlike the descendant combinator, there can’t be another element wrapping .box—it has to be a direct child element. ... In this example, the CSS from the previous code example will apply only to the first <div> element that has a class of box.
🌐
TutorialsPoint
tutorialspoint.com › css › css_selectors.htm
CSS - Selectors
The syntax for the pseudo-class selector is as follows: a :hover { background-color: peachpuff; color: green; font-size: 2em; } The following example demonstrates the use of a pseudo-class selector.
🌐
Shay Howe
learn.shayhowe.com › advanced-html-css › complex-selectors
Complex Selectors - Learn to Code Advanced HTML & CSS
Selectors are one of the most important parts of CSS, and this lessons discusses selectors, old and new, and how to best put them to use inside a website.
🌐
Codecademy
codecademy.com › learn › fscp-web-development-fundamentals › modules › fecp-learn-css-selectors-and-visual-rules › cheatsheet
Web Development Fundamentals: Learn CSS: Selectors and Visual Rules Cheatsheet | Codecademy
In this example, only color: blue will be implemented as it has an ID selector whereas color: red has a type selector. ... The CSS ID selector matches elements based on the contents ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Selectors › Universal_selectors
Universal selectors - CSS | MDN
November 17, 2025 - Note: The universal selector (*) matches elements only. It does not directly match pseudo-elements by itself. To match all ::before pseudo-elements on a page, for example, you would have to use a selector like *::before.
🌐
W3C
w3.org › TR › selectors-4
Selectors Level 4
January 22, 2026 - For example, the :lang() selector depends on the document language (e.g. HTML) to define how an element is associated with a language. As a slightly different example, the ::first-line pseudo-element depends on the host language (e.g. CSS) to define what a ::first-line pseudo-element represents ...
🌐
Simmons University
web.simmons.edu › ~grabiner › comm244 › weekfour › selectors.html
CSS Selectors
To match a specific class attribute, we always start the selector with a period, to signify that we are looking for a class value. The period is followed by the ... For example, if we wanted all elements with a class of "highlight" to have a different background color, we would use the following CSS rule:
🌐
Acquia
docs.acquia.com › web-governance › pageassist-setup-css-selectors
PageAssist setup with CSS selectors
The selector below will select the 2nd p element in this example: ... Takes the parent element of the selected element. We have created a series of custom CSS selectors that do NOT exist in normal CSS and only in the PageAssist system.
🌐
Testmuai
testmuai.com › testmu ai › learning hub › css selectors in selenium
CSS Selectors in Selenium: A Complete Guide to Locating Web Elements
February 3, 2026 - Select the Target Element: Click the Select Element icon in the top-left corner of the Developer Tools window. Then, click on the web element you want to inspect, for example, the “Enter Message” field in the Simple Form Demo. Copy the CSS Selector: Right-click on the highlighted HTML element in the DOM and select: Copy > Copy selector.
🌐
Envato Tuts+
webdesign.tutsplus.com › home › web design › html/css › html
The 30 CSS Selectors You Must Memorize | Envato Tuts+
June 7, 2023 - For example, consider the following markup. A selector of #container > ul will only target the uls which are direct children of the div with an id of container. It will not target, for instance, the ul that is a child of the first li.