1.2.6 • Published 5 months ago
@saekitominaga/htmlelement-text v1.2.6
Get the text width (width of the inline box) of the HTMLElement
Demo
Examples
<script type="module">
import HtmlElementText from './dist/HtmlElementText.js';
for (const textElement of document.querySelectorAll('.js-text-width')) {
const htmlElementText = new HtmlElementText(textElement);
console.debug(`${htmlElementText.getWidth()}px`);
}
</script>
<span class="js-text-width">Hello world!</span>
Constructor
new HtmlElementText(
thisElement: HTMLElement
)