I'm trying to use the contains selector in css and the first child selector together and can't get it to work. It works without the :first-child selector which makes me think maybe its just not possible? For my example below I only want the first p with the id of taco to have a background-color of yellow.
<!DOCTYPE html>
<html>
<head>
<style>
p[id*="taco"]:first-child {
background-color: yellow;
}
</style>
</head>
<body>
<p>This paragraph is the first child of its parent (body).</p>
<p>This paragraph is not the first child of its parent (body).</p>
<p>This paragraph is the first child of its parent (div).</p>
<p>This paragraph is not the first child of its parent (div).</p>
<p id="taco">This paragraph is the first child of its parent (body).</p>
<p id="taco">This paragraph is not the first child of its parent (body).</p>
<p id="taco">This paragraph is the first child of its parent (div).</p>
<p id="taco">This paragraph is not the first child of its parent (div).</p>
</body>
</html>
I tried to use both selectors. I tried using the first child without the contains selector and it worked. I also tried to use the contains selector without the first child selector and that works but using them together doesn't.