- Source:
Methods
(static) fontScale(element, maxHeight) → {Number}
Scale an element's font size so that it doesn't overflow the viewport.
Note that some css may be required for this to work,
for example setting display: flex; on the parent element,
and this function relies on the element being visible.
If you want to keep your element invisible until font scaling finishes,
use opacity: 0;
Parameters:
| Name | Type | Description |
|---|---|---|
element |
HTMLElement | the element to be scaled |
maxHeight |
Number | maximum font size (which is equivalent to pixel hight) |
- Source:
Returns:
the resulting font size
- Type
- Number