How can i sort cards in a fixed width no matter how many card i have?

im making a cards game and i want the cards in player’s hand to be sorted with fixed width, so if i have 5 cards or 20 cards they both won’t exceed the fixed width but the spacing between them will be smaller.
i tried doing it using Horizontal Layout but it didn’t work, any tips?

The horizontal layout is what you want. Simply, it will start to do the wrong things if the content doesn’t fit well the size of your card zone. Adding a content size fitter to all of your cards, which should be direct children of the layout group, should do what you want :slight_smile:

https://docs.unity3d.com/2020.3/Documentation/Manual/script-ContentSizeFitter.html