Is there a way to target only the p tag with id="this" using .root p:first-child selector?
Here is the code snippet:
.root p:first-child {
background-color: green;
}
p {
margin: 0;
}
.container {
display: inline-box
}
.root {
display: flex;
}
div {
display: block;
background-color: pink;
border: 1px solid red;
width: 100px;
height: 100px;
}
<div class="root" id="this">
<div class="container">
<p>test</p>
</div>
<div class="container">
<p>test2</p>
</div>
<div class="container">
<p>test3</p>
</div>
</div>