# StretchToParentWidth(VisualElement)

> Aligns a VisualElement's left and right edges with the corresponding edges of its parent.

## Definition

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

```csharp
public static void StretchToParentWidth(this VisualElement elem)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.7/script-reference/unityengine/uielements/visualelement)): The element to be aligned with its parent

### Remarks

This method provides a way to set the following styles in one operation:

* [\_position](/engine/6000.7/script-reference/unityengine/uielements/istyle/position.md) is set to [Position.Absolute](/engine/6000.7/script-reference/unityengine/uielements/position/absolute.md)

* [\_left](/engine/6000.7/script-reference/unityengine/uielements/istyle/left.md) is set to 0

* [\_right](/engine/6000.7/script-reference/unityengine/uielements/istyle/right.md) is set to 0
