Alignment

The alignment property determines how the children will be aligned within a view. There are 9 options:

  • top-left
  • top-center
  • top-right
  • left
  • center
  • right
  • bottom-left
  • bottom-center
  • bottom-right

Alignment also applies to text within a view, unless overridden by the text-align property.

alignment

The alignment of a view can be specified using the respective layout modifier:

VStack::new(cx, |cx|{
    Label::new(cx, "Hello");
    Label::new(cx, "World");
})
.alignment(Alignment::Center);

Or in CSS:

.container {
    alignment: center;
}