Utility classes for changing an element's background scale mode property.

Classes for background scale mode are named using the format: [bg]-[scaleType].

Where scaleType includes:

  • stretch - for -unity-background-scale-mode: stretch-to-fill
  • scale-crop - for -unity-background-scale-mode: scale-and-crop
  • scale-fit - for -unity-background-scale-mode: scale-to-fit
ClassContents

Note that -unity-background-scale-mode: stretch-to-fill is the default value for background scale mode in Unity. Unless the value needs to be overridden from a parent, the bg-stretch class is not needed.

It is highly recommended to override the default stretch-to-fill, and use scale-to-fit with a wrapping VisualElement for images.

UXML

UXML

UXML