Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
big-text.js
Advanced tools
A lib that makes text as big as possible while still fitting on the parent element.
A JavaScript lib that makes text as big as possible while still fitting on the parent element. Based on DanielHoffmann/jquery-bigtext.
npm install --save big-text.js
import BigText from 'big-text.js';
BigText("#span",{
rotateText: {Number}, (null)
fontSizeFactor: {Number}, (0.8)
maximumFontSize: {Number}, (null)
limitingDimension: {String}, ("both")
horizontalAlign: {String}, ("center")
verticalAlign: {String}, ("center")
textAlign: {String}, ("center")
whiteSpace: {String}, ("nowrap")
});
rotateText: Rotates the text inside the element by X degrees.
fontSizeFactor: This option is used to give some vertical spacing for letters that overflow the line-height (like 'g', 'Á' and most other accentuated uppercase letters). This does not affect the font-size if the limiting factor is the width of the parent div. The default is 0.8
maximumFontSize: maximum font size to use.
limitingDimension: In which dimension the font size should be limited. Possible values: "width", "height" or "both". Defaults to both. Using this option with values different than "both" overwrites the element parent width or height.
horizontalAlign: Where to align the text horizontally. Possible values: "left", "center", "right". Defaults to "center".
verticalAlign: Where to align the text vertically. Possible values: "top", "center", "bottom". Defaults to "center".
textAlign: Sets the text align of the element. Possible values: "left", "center", "right". Defaults to "center". This option is only useful if there are linebreaks (<br>
tags) inside the text.
whiteSpace: Sets whitespace handling. Possible values: "nowrap", "pre". Defaults to "nowrap". (Can also be set to enable wrapping but this doesn't work well.)
<div style="width: 300px, height: 200px">
<span id="span">BigText</span>
</div>
BigText("#span");
With one simple line the text "BigText" will now have its font-size increased but without overflowing the element parent div.
See more examples in https://brorlandi.github.io/big-text.js/
This project is released under the MIT license.
FAQs
A lib that makes text as big as possible while still fitting on the parent element.
We found that big-text.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.