Version: 2023.2
Introduction to USS
Type selectors

USS 选择器

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 描述
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 tree.
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.

其他资源

Introduction to USS
Type selectors