Get started with textfit CDN

MIT licensed

TextFit: Flutter library for sizing, positioning text to fit constraints.

Tags:
  • textfit
  • fit
  • text

Stable version

Copied!

How to start using textfit CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with textfit CDN - cdnhub.io</title>
  <style>
    #container {
      width: 200px;
      height: 100px;
      border: 1px solid black;
      overflow: hidden;
    }
  </style>
</head>
<body>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/textFit.min.js"></script>
  <script>
    const container = document.getElementById('container');
    const text = document.createElement('p');
    text.textContent = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisi quis bibendum laoreet, tellus metus bibendum velit, nec luctus tellus nibh sit amet quam.';

    textFit(text, container, { maxWidth: container.offsetWidth });

    container.appendChild(text);
  </script>
</body>
</html>
Copied!
Copied!

All versions