# Class

> Selects all elements with the specified class in the class list, as specified with the class attribute in a UXML file or added with VisualElement.AddToClassList method.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## Class(string)

Selects all elements with the specified class in the class list, as specified with the `class` attribute in a UXML file or added with [VisualElement.AddToClassList](/engine/6000.6/script-reference/unityengine/uielements/visualelement/addtoclasslist.md) method.

```csharp
public UQueryBuilder<T> Class(string classname)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The class to use in the query.

### Returns

| Type                                                                                          | Description |
| --------------------------------------------------------------------------------------------- | ----------- |
| [UQueryBuilder\<T>](/engine/6000.6/script-reference/unityengine/uielements/uquerybuilder1.md) |             |

### Remarks

This method can be called multiple times in order to select elements with multiple classes. To select elements by their C# type, use UQueryBuilder\<T>.OfType.

## Class(UniqueStyleString)

Selects all elements with the specified class in the class list, as specified with the `class` attribute in a UXML file or added with [VisualElement.AddToClassList](/engine/6000.6/script-reference/unityengine/uielements/visualelement/addtoclasslist.md) method.

```csharp
public UQueryBuilder<T> Class(UniqueStyleString classname)
```

### Parameters

**** (\[UniqueStyleString]\(/engine/6000.6/script-reference/unityengine/uielements/uniquestylestring)): The class to use in the query.

### Returns

| Type                                                                                          | Description |
| --------------------------------------------------------------------------------------------- | ----------- |
| [UQueryBuilder\<T>](/engine/6000.6/script-reference/unityengine/uielements/uquerybuilder1.md) |             |

### Remarks

This method can be called multiple times in order to select elements with multiple classes. To select elements by their C# type, use UQueryBuilder\<T>.OfType.
