text-wrap pretty made my pills overflow on phones
In October, Framer's Marketplace review took four of my templates down. One of the problems they flagged looked tiny: on phones, the text in some pills and price tags ran past the edge of the pill. A price like "€6,900 /
In October, Framer's Marketplace review took four of my templates down. One of the problems they flagged looked tiny: on phones, the text in some pills and price tags ran past the edge of the pill. A price like "€6,900 / week" spilled out of its card.
The cause was a setting I had turned on to make text look better.
The setup
In Framer, text styles have a Text Wrap option: default, balance or pretty. Balance evens out line lengths, and pretty avoids a single word stranded on the last line. Both map to the CSS text-wrap property, and both make headings and paragraphs look more polished.
So I had set pretty wrap on almost every text style, including the label and button styles. Those styles are used inside pills that size themselves to their text, which in Framer means auto width (in CSS terms, the pill shrinks to fit its content).
What went wrong
On desktop everything looked fine. On a narrow phone, where a pill had to wrap or squeeze, the text stopped fitting inside it. Framer publishes these text layers with white-space: pre-wrap, and with balance or pretty wrap on top, the auto-width pill ended up sized by its longest word rather than by its text. The rest of the text overflowed the pill instead of the pill growing or the text wrapping cleanly.
It only showed at small widths, so I never saw it at the three breakpoints I usually looked at.
The fix
Set Text Wrap back to default on the label and button styles. That fixed every pill at once, because they all shared those styles.
In plain CSS terms:
/* Pills, tags, buttons: let them wrap normally */
.pill, .button, .tag {
text-wrap: wrap;
}
/* Keep the nicer wrapping where it helps: headings in containers with a set width */
h1, h2 {
text-wrap: balance;
}
I still use balance on big headings, where a lone word on the last line looks bad and the container's width doesn't depend on the text.
How to catch it
- Check your published site at a 320 px phone width, not just the breakpoints your tool gives you. Small phones show wrapping problems first.
- Look at every component that sizes itself to its content: pills, tags, chips, buttons and badges.
- Change shared text styles carefully. One setting on a style touches every layer that uses it, which is how one checkbox broke pills across a whole template.
The other two things that review flagged were a hover zoom that grew past its frame and buttons that linked to a deleted page. I wrote all three up, together with the rest of my pre-submission checks, here: the Framer template checklist I use before every submission.
Where do you use text-wrap: balance or pretty, and have you seen it misbehave?
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.