---
title: center
framework: swiftui
role: symbol
role_heading: Type Property
path: swiftui/horizontalalignment/center
---

# center

A guide that marks the horizontal center of the view.

## Declaration

```swift
static let center: HorizontalAlignment
```

## Discussion

Discussion Use this guide to align the centers of views:

The following code generates the image above using a VStack: struct HorizontalAlignmentCenter: View {     var body: some View {         VStack(alignment: .center, spacing: 0) {             Color.red.frame(width: 1)             Text("Center").font(.title).border(.gray)             Color.red.frame(width: 1)         }     } }

## See Also

### Getting guides

- [leading](swiftui/horizontalalignment/leading.md)
- [trailing](swiftui/horizontalalignment/trailing.md)
- [listRowSeparatorLeading](swiftui/horizontalalignment/listrowseparatorleading.md)
- [listRowSeparatorTrailing](swiftui/horizontalalignment/listrowseparatortrailing.md)
