Hi @Sluggy1 !
So this happens because, as you have found out, Button has the .unity-button class added to it and classes have a higher specificity than types.
By curiosity, which version of Unity are you using? On more recent versions, the “built-in” themes should not prevent you from overriding it, since they should be marked as having lower priorities.
In your case, it might also happen if another selector further down is also a match. You can check on a per-element basis in the UI Builder by selecting it in the hierarchy pane and looking at the “StyleSheet > Matching Selectors” section of the inspector pane. Alternatively, you can also use the UI Toolkit debugger to see the matching selectors.
That should not be the case.
You should be able to do that by using .unity-toggle:focus .unity-toggle__label.
Is the Theme.uss file that you have in your screenshot importing the default style sheet per chance? If that is the case, it would explain why you are not getting the results you are looking for. There again, you can use the UI Toolkit debugger to figure out which selectors are being applied, in which order and their origin.
I agree.
If you are currently editing the selector of a style sheet, the values with a white override bar are the only values that matters, all the other values “don’t exist” and are not being applied anywhere.
If you are currently editing an element, the values with a white override bar indicates an inline style (so a style that will be applied no matter what comes from styles). Values without the white override bar are showing the computed value for each property. So in that sense, they are showing what the value will be as the result of the stylesheet chain. Again, you can see the matching selectors for an element by selecting it and looking at the matching selectors section.
I’m not entirely sure if this has reached the version you are using yet, but on an element, you can hover over the label of a style field and it should give you the following information (see included image):
- The uss property name
- The type of the value (constant value, variable value, etc.)
- Which selector of which style sheet last modified this style property
Hope this helps.
