Why does "span.unbox>:last-child" not work?

I added this line at the end of the CSS

span.unbox>:last-child{
    display: block;
}

However, the hidden contents inside Wordfinder and Word Origin do not show up, although they are of span.unbox>:last-child.

Could you please elaborate on this problem?

oald10.zip (13.0 KB)

They do not show up because “div.collapse ul {display: none;}” takes effect.

As for “span.unbox>:last-child{display: block;}”, it worked as you expected, though.

I thought that if 2 styles in a CSS file affects the same elements. Then the one comes after (here span.unbox>:last-child) will take override the result, no?

“span.unbox>:last-child {display: block;}” can override “div.collapse .body {display: none;}”, but it does not do anything about element “ul” inside “.body”.

1 个赞

Got it. Thank you so much for your help! If you don’t mind, please have a look at my closely-related question.