Fit To Width – CSS-only stretchy text Icon

Fit To Width – CSS-only stretchy text

By Kevin Batdorf

Active Installs

30+

Last Updated

April 12, 2026

First Released

August 25, 2025

Download History (Last one month)


Contributors

A simple, lightweight block for displaying each line of text at full width, no matter the length of the text. No JavaScript.

Star the project on GitHub: https://github.com/kevinbatdorf/fit-to-width

Note: if you are installing it for the first time from the Block Inserter, WordPress has a bug where it doesn’t load block styles into the iFrame, so you will need to refresh.

  1. Upload the plugin files to the /wp-content/plugins/fit-to-width directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
What about browser support?

See here https://caniuse.com/mdn-css_at-rules_property

How did you do it?

For a detailed explanation of how this works, see https://kizu.dev/fit-to-width.

Is it accessible?

I guess that depends on your perspective and legal requirements. First thing I’ll say is that this technique outshines the alternatives, and those alternatives also suffer from the same caveat:

It won’t pass Success Criterion 1.4.4 Resize Text when the zoom is dependent on the viewport.

I’m by no means an expert on this, so if you’re interested in the topic, there’s a good discussion on this GitHub issue: Feature for making text always fit the width of its parent that I recommend reading.

There are arguments that if you maintain a width legible enough then zooming may not be an issue. My advice, however, is that you make sure that your text is able to zoom in up to 2em in size for all screen widths (press cmd/ctrl +/- to test).

Changelog

0.2.0 – 2026-04-12

  • Modernize tooling: Biome, Playwright + WP Playground, updated deps.
  • Update CI workflows to use node lts/*.
  • Tested up to WordPress 7.0.

0.1.0

  • Initial Release
<br />
<b>Warning</b>:  Undefined array key /home/ylinkin/truewp.net/wp-content/plugins/truewp-plugin-info/truewp-plugin-info.php on line 756
" width="120" height="120">

Available Versions

Version Download Type
0.2.0 Download Stable
0.1.0 Download Stable
Development Download Trunk

Plugin Info

  • Version: 0.2.0
  • Last Updated: April 12, 2026
  • Active Installs: 30+
  • WordPress Version: 6.7 or higher
  • Tested up to: 7.0
  • PHP Version: 7.4 or higher
  • Tags:    
    block creative responsive-text stretchy typography

Ratings


0.0 out of 5 stars. (0 reviews)

See all reviews
Scroll to Top