If this is my html structure:
<tr class="editing">
<td class="col-2"></td>
<td class="col-2"></td>
</tr>
how come this nested css works fine:
.editing {
padding: 1em 1.5em;
.col-2 {
font-size: 11em;
}
}
but this does not:
.editing {
padding: 1em 1.5em;
td {
font-size: 11em;
}
}
I am using Chrome 114 and according to https://caniuse.com/css-nesting CSS nesting is supported. I know how to use a non-nested approach this is an exercise in using a newly supported CSS feature.
2
Answers
nested CSS selectors are not supported (yet) in all browsers. It’s not really recommended to do that right now.
You should just use them un-nested like this:
According to this article:
…and the spec:
This means you need to rewrite your second rule as:
…or: