STRML / textFit

A jQuery-free component that quickly fits single and multi-line text to the width (and optionally height) of its container.
https://textfit.strml.net
637 stars 123 forks source link

Fit all the <p> inside a div #41

Open ArtemisGraphic opened 4 years ago

ArtemisGraphic commented 4 years ago

Is it possible to fit all the p elements inside a div? I have a div with fixed width and height 300px and 600px, with many p elements inside, I tried with textFit(document.querySelectorAll(".box" + "p")); but nothing changes. If I remove p tags and just do textFit(document.querySelectorAll(".box")); it works, but I really need paragraphs. Any way to do this?

MattiJarvinen commented 4 years ago

Try: textFit(document.querySelectorAll(".box + p"))

ArtemisGraphic commented 4 years ago

I tried but it doesn't work, I get no errors though. It works with just textFit(document.querySelectorAll(".box")) if I remove the p tag, but I really need p.