HBoxContainer containing different-sized buttons

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


I’m trying to build a scrolling bar the contains different sized buttons:

enter image description here

As you can see, if I use the separation attribute of HBoxContainer, the buttons are evenly spaced, creating irregular gaps between each other.

I have tried all sorts of combination of Size Flags and Stretch Ratio. I haven’t been able to:

  1. get the buttons to space according to their size (with a small margin between each) and
  2. keep the box scrollable.

The HBoxContainer is placed inside a ScrollContainer and each button is subsequently added as a child of the HBoxContainer in the scripts.

At this point any help would be welcome!


:bust_in_silhouette: Reply From: XavierGerD

Not sure if anyone has or will see this but essentially, the gist of the problem is that I can’t seem to align all buttons to the left. For some reason, they are being spaced out equally as per their left side, essentially creating a gap. What I want is for them to all be crammed to the left side, much like with display: flex in CSS.