Quick answer: UIDocument inspector → assign Source Asset (UXML referencing USS), or programmatically root.styleSheets.Add(uss).
Style file looks great in builder. In runtime build, none of the styles apply. UXML didn't reference the USS, or load order broke.
The Fix
/* myView.uxml */
<ui:UXML>
<Style src="myStyles.uss" />
<ui:VisualElement class="container" />
</ui:UXML>
// Or runtime
[SerializeField] StyleSheet _stylesheet;
void Start() {
var root = GetComponent<UIDocument>().rootVisualElement;
root.styleSheets.Add(_stylesheet);
}
Style src in UXML is the declarative path. styleSheets.Add for dynamic theming.
Verifying
Styles apply in build. Without reference: default flex layout, no custom styling.
“Reference USS. Styles apply.”
Related Issues
For UXML binding, see binding. For flex-wrap, see flex-wrap.
Reference USS. Styles flow.