0

I'm having an issue with CSS. It seems to only select items with the :last-child pseudo selector.

My markup:

<tr class="emtpy-row">
    <td></td>
    <td></td>
</tr>

My CSS:

.THIS .empty-row td,
.THIS .emtpy-row td:last-child {
    background-color: hotpink;
}

But, only the second td turns pink.

This is very strange to me. Anyone have an idea what's going on?

  • Could it be possible that an another style is applied with a higher priority rule? By precising :last-child, your rule is prioritized. – Martin Lezer Feb 23 '17 at 16:09
2

Seems you have a typo. Your CSS says .THIS .empty-row td,, but the class is emtpy-row.

The :last-child pseudo-selector does not have the typo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.