Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size 100% doesn't render the text properly #121

Closed
MarcoCatalan opened this issue Aug 31, 2018 · 4 comments
Closed

Size 100% doesn't render the text properly #121

MarcoCatalan opened this issue Aug 31, 2018 · 4 comments
Assignees
Milestone

Comments

@MarcoCatalan
Copy link

When you specify a size of 100%, the text inside doesn't render properly. It renders very small and not centered
I believe this is caused by:

  • The division by 3 when calculating the fontSize. If you specify a percentage it is not relative to the parents height, but to the parent text-size (1em). Making the fontSize relative to the parents height looks like a very tricky problem to solve.
  • The same happens with the line-height attribute. Maybe another technique for centering should be use, such as flexbox (?)
@MarcoCatalan
Copy link
Author

MarcoCatalan commented Aug 31, 2018

Looks like someone made a React fork of the FitText plugin which may be useful in this scenario (http://softwarepsychonaut.com/react-fittext/)

@MarcoCatalan
Copy link
Author

In my opinion, a much better option would be to use svg's to render the icons. I made a couple of tests and it works flawlessly without the need to define a fixed size, just matching the parent size:

-https://codepen.io/anon/pen/oPBGNa
-https://codepen.io/anon/pen/bxgoWe

@JorgenEvens
Copy link
Member

Sadly the SVG approach breaks down as well when we consider that not all initial have exactly two characters in them.

@JorgenEvens
Copy link
Member

This issue has been fixed in the v3.3.0 release. Thanks for the bug report and the help looking for a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants