H1 turning blue outside of class scope

Am I going insane? Why is this happening? I only want the p and h1 in the "one" class to turn blue. Codepen: https://codepen.io/SirFloki/pen/VwGjYJp
Daniel
CodePen
VwGjYJp
...
3 Replies
Jochem
Jochem3y ago
you need this:
.one h1, .one p{
color: blue;
}
.one h1, .one p{
color: blue;
}
The comma completely resets the selector Alternatively:
.one :is(h1, p) {
color: blue;
}
/*or*/
.one :where(h1, p) {
color: blue;
}
.one :is(h1, p) {
color: blue;
}
/*or*/
.one :where(h1, p) {
color: blue;
}
sirfloki.
sirfloki.OP3y ago
I see...so the second selector after the comma is selecting all paragraphs and isn't scoped to the "one" class. It's very odd this is the first time I've run into this issue. But now I know. Thanks!
Jochem
Jochem3y ago
That's correct. And you're welcome glad to help!

Did you find this page helpful?