Skip to content

KevinBatdorf/fit-to-width

Repository files navigation

Fit to Width

A WordPress block that automatically adjusts the text to fit the width of its container. CSS only.

For a detailed explanation of how this works: Fit-to-Width Text: A New Technique.

Features

  • No JavaScript
  • Can manually adjust line height

Twitter

Fit to Width

FAQ

Is this 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).

More discussion here at Fit-to-Width Discussions & Feedback

About

A WordPress stretchy text block where each line is automatically full width.

Resources

Stars

Watchers

Forks

Sponsor this project

 

Contributors