A function that given input element, updates its width to fit its content.
- Install by executing
npm install update-input-width
oryarn add update-input-width
. - Import by adding
import updateInputWidth from 'update-input-width'
. - Pass input element to it. Forget.
A function that given input element, updates its width to fit its content by setting inline width
CSS property.
42
import updateInputWidth from 'update-input-width';
or
import { updateInputWidth } from 'update-input-width';
A function that given HTML element returns font CSS shorthand property. Equal to Chrome-only code:
window.getComputedStyle(element).font
"normal normal 600 normal 20px / 25px Arial, sans-serif"
import { getFontShorthand } from 'update-input-width';
A function that given text and font CSS shorthand property returns text width in pixels.
42
import { measureText } from 'update-input-width';
The MIT License.
![]() |
Wojciech Maj [email protected] http://wojtekmaj.pl |