How to choose specific element
Hi!
In this code I want to select the first
<p>
in both, but with different color.
In the one with class:"schedule-item ice-spice"
I want the first <p>
to be blue, in the second, with class="schedule-item performance"
I want the first <p>
to be red.
I've lost my ways. I want to avoid using :has()
since I know many will use an older phone. When I use p:first-child
the entire schedule-item
changes color, and not just the first <p>
.
A bit lost now ...
2 Replies
Well, you just target it like this:
.ice-spice p:first-child {
color: blue;
}
.performance p:first-child {
color: red;
}
💩 to me ...
I red the MDN docs, and got totally confused ...
I thought I had to do
p:first-child
before doing anything ...
But hey! That's why this is the greatest Discord.
Thank you so much! :thumbup: