Good ways to fit text to the container size?

I was looking for ways to dynamically resize the text to fit it's container. It is for a mobile application, so I don't really have to worry about screen resizing much, but I do need to support a variety of resolutions.

I've tried a lot of different options, but I'm not really sure what will be supported on mobile devices. I've looked at CSS stuff like vh, vw, and em, but none of them are great solutions. I also tried using this library:
by making it work by finding elements of a class and resizing objects of that class, but it might make the application a lot less responsive on some mobile devices, because the text size needs to be recalculated quite often (Every time an element is displayed again after leaving the screen). I haven't found a good way to do it in Enyo, CSS, or JS, but I am pretty knew to all of these technologies, as well as web development, so I might be missing something obvious.

I was also wondering if there is a good wait to center text in its container, not just horizontally, but vertically as well, and without resizing the container due to overflow. Again, with mobile support.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!