Need make an template with the following features:
The answer to 1st question is simple, but adding it here, because don't know than the second question is not depending on it.
Here are already many questions what asking how to dynamically resize the text in the textarea or input fields. But this question is more special, because probably need counting words or somewhat other to fit the container size.
Can please someone help me with some pointers to already done jquery or any other js/css solution?
I'm not a web designer and want make only one simple web page template what will use to fit my texts - i know a little bit css - but not javascript - therefore asking to the pointer to any "ready-to-run" solution, if exists...
Checking overflow solutions, this answer https://stackoverflow.com/a/7138971/869025 works nicely to detect vertical overflow. Now the questions is, how to add the above overflow javascript check to the cycle, what will change my font to smaller.
For the better illustrating attaching two demo images...
The font-size-adjust property of CSS tells the browser to adjust the font size of the text to the same size regardless of font family. When the first chosen font is not available, the font-size-adjust property allows you more control over the font size.
Using FitterdBox, Wrap the Text Widget into FittedBox Widget with fitWidth parameter. width: 250, height: 20, child: FittedBox(fit:BoxFit.
Basically, you need the next:
while( is_overflow_in_the_second_div() ) {
set_smaller_font();
}
So, you should check questions with
and like, e.g.:
maybe many others.
Maybe you don't searched the questions for the right keyword, but this is probably an duplicate. :)
I think you could check this question: JavaScript Scale Text to Fit in Fixed Div
As I understand that's what you need.
EDIT: I found something really interesting in Gist: https://gist.github.com/mekwall/1263939
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With