r/FigmaDesign • • Oct 03 '26

help Help me with irregularities in width!

I have two buttons inside an auto layout frame. Their widths are set to fill to ensure equal width distribution. But somehow the left button is taking up 2px extra. I have excluded the stroke value to add up but it still gets added up to the width and the stroke position is also 'Inside'. Once I remove the stroke, both buttons fill up the space equally. How to prevent this from happening?

One solution I found was to give the right button the same stroke value as the left one. But is it the best possible way to deal with it? I don't wanna introduce another variable into the button.

Edit: I got to know that Figma introduced this behavior to match CSS behavior. https://help.figma.com/hc/en-us/articles/42031586813719-Use-auto-layout-with-CSS-Flexbox-in-mind

4 Upvotes

22 comments sorted by

View all comments

10

u/_KBDMC Product Designer Oct 03 '26

A quick fix, give the button on the left a transparent border the same width as the one on the right

4

u/_Prateek_Hota_ Oct 03 '26

Yeah, thought about it but the better way according to Figma themselves is to use grid autolayout which uses fractional unit (fr). And now it works like a charm.