How do you handle responsive layouts

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By x-leopold

body {
margin: 0 auto;
width: 1200px;
}

This is a piece of HTML/CSS layout code. When it is greater than 1200px, it will be displayed in the center. If it is less than 1200px, it will be left-aligned

:bust_in_silhouette: Reply From: Zylann

I’m not aware of a system replicating this behavior in Godot. Layouts work a bit differently compared to HTML. In Godot, controls are laid out using margins (pixel offsets of 4 sides relative to the parent), anchors (parent size ratio from which margins are relative) and specific containers (CenterContainer, VBoxContainer, SplitContainer etc). If this is exactly the behavior you want, I guess you need to write your own container which lays out your content according to the rules you described. This is done by creating a Container node which is anchored to the borders of the screen, with a script on it that overrides sort_children() (see documentation).
Then, you put your body as child of this container.