This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Jacob Berlow
Posted Dec 12 - Read on Facebook

I would like to have a layer's height be determined by the amount of text inside its html content (given the style of that text). Is there any way to do this? Thanks!

3 Comments

Sigurd Tapio Mannsåker

One trick is that when you add some text via the HTML property, it's actually wrapped in a div. You can set it to display: inline-block, and then check its offsetHeight. On mobile and I forget the exact name of the property, but there's a reference to it on your layer object. Something like layer._innerElement or something.

Chris Camargo
Jordan Robert Dobson

I do exactly that for my Text module that's available on github.

Http://github.com/Seattle-Framer

Read the entire post on Facebook