USS Selection Bug

Hi,

I have a scrollview.
7412441--906503--Screen Shot 2021-08-12 at 10.44.38 AM.png

In my USS this works.

#spacer
{
    background-color: white;
}

This doesn’t work.

#unity-content-container #spacer
{
    background-color: white;
}

Is this a known issue/limitation?

Thanks

Yes, this is because the ScrollView is considered to be the parent of #spacer for selector matching.
It is consistent with the “parent” property of the VisualElement (and the fact that you do “scrollView.Add(spacer)”).

2 Likes