HTML & CSS
I have a demo here to illustrate
Is it possible to have a 100% text size so it fills the available space and then change size with the <p> if the window is resized.
In my demo the text in paragraph two is set to fill the paragraph by trail and error and if the window is resized the text wraps.
Grumpy cat says "NO!" ( at least with pure CSS)
So I take what you are trying to do is 'copyfit' on the web. Think of it this way: in CSS the content determines the size of the container, but not the other way around. This would be no different in text ( which essentially is an anonymous content shell that by definition cannot contain anything itself) . BESIDES the biggest sin in web design is to take control of text size from the viewer.
Am afraid thsi just not possible with plain CSS, nor is it something that would be considered as a property n future CSS.
Than begin said .js can do it in convoluted ways (ON WINDOW RE SIZE: counting characters, and obtaining container size, then setting the CSS ..etc) and keep in mind that this wont be perfect either as not all letters are the same size anyway ( you always need humans for true copy fitting)
Check out for instance http://fittextjs.com/
This topic is now closed. New replies are no longer allowed.