This could be the silliest question I've ever made, but why does the text below is not rendered red?
<html>
<style>
.c1 .c2 {
color: red;
}
</style>
<body>
<span class="c1 c2">This should be red</span>
</body>
</html>
Edit: I want to match elements that contain both c1 and c2 classes, like the example above, no less.
.c1 .c2
matches a c2 element inside a c1 element, just like html body
matches a body element inside an html element. Remove the space to match an element with both classes:
.c1.c2 {
color: red;
}
It should be .c1.c2
. The way you have it written is a c2
INSIDE a c1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With