Version: 2022.1
Introduction to USS
Type selectors

USS selectors

Selectors decide which elements that USS rules affect.

USS supports a set of simple selectors that are analogous, but not identical, to simple selectors in CSS. A simple selector matches elements by element type, USS class, element name, and wildcard.

You can combine simple selectors into complex selectors, or append pseudo-classes to them to target elements in specific states. USS supports descendant, child, and multiple complex selectors.

Topic Description
Type selectors Match elements based on their element types.
Name selectors Match elements based on the name of an element.
Class selectors Match elements that have specific USS classes assigned.
Universal selectors Match any element.
Descendant selectors Match elements that are descendants of another element in the visual treeAn object graph, made of lightweight nodes, that holds all the elements in a window or panel. It defines every UI you build with the UI Toolkit.
See in Glossary
.
Child selectors Match elements that are children of another element in the visual tree.
Multiple selectors Select elements that match all the simple selectors.
Selectors list Create a comma-separated list of selectors that share the same style rule.
Pseudo-classes Use pseudo-classes with selectors to target elements that are in a specific state.
Selector precedence Understand USS precedence when multiple USS rules target the same elements.

Additional resources

Introduction to USS
Type selectors
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961