Text box height is larger than the text inside and unevenly. How to solve the padding issue?

It’s known the text line hight it’s a nightmare. However, I’m struggling with the text box hight even more with Figma Auto Layout.


When giving “padding” on Figma auto-layout to a button, the text position (inside the box, not the box) is not in the centre height. In the following example, you can see that in one font type there is 2 px space at the bottom and 1 at the top and in the other one, 2px at the top and 1 at the bottom.

That’s led to; 1, the text is not in the centre height, 2, the padding is getting extra which then lead to the wrong implementation.

Later on CSS, the text div won’t behave like that and will wrap right around the text.

The ideal is that the space (padding) above and below the text is even and exactly as set in the padding.

Is anyone have a solution for this challenge?

This is how fonts work, you can’t do much here. And “later on CSS” you will have exactly the same issue, although it might be less visible since you won’t be able to zoom in that much.

2 Likes

I have been trying to figure out a solution for the same problem. So far the text height options have been a sort-of solution, being Auto Height the one that I use the most. Truncate I guess can also work. Let me know if this was of any help!

Screenshot 2022-11-09 at 12.45.08 AM

@Shneor
I’m not sure if that helps you but at least on visual side works, you can put a the text inside a container frame and adjust it to desired center of the frame and then put that frame in your auto layout (if Applicable).

Hello all! It seems that there is still no satisfactory solution to this problem? :frowning:

For me setting the auto-height does not solve the problem…

I am having the exact same issue (to the point that I thought I wrote this post :smiley:) We are trying to define fonts, text box behavior, and auto-layout for a design system, so this is a serious problem.

There is more space above the ascender than there is below the descender. Ideally it should be equal!

1 Like

You can now use vertical trim to remove the extra space above and below text:

3 Likes

Wow cool! Thank you!

1 Like

Hi! Would it be useful to create some kind of utility to resolve this issue? If so, I could do that and let you know!

Is there any way to make this the default behavior for text project wide? Short of using components I mean.