Hi, I stumbled on a problem, I am playing with responsive design, all my div, h and p elements are in percentage, so they all resize properly. but how do I do the same with font size? I read that em and percentage are good for resizing, but I tried it and it doesn't do a thing, what did I do wrong?
Hard to tell without seeing your code. Are you setting percentages for the elements the text is in (including the body) as well as the 'em' sizes for the font?
Thanks for the reply.There is no need to see my code, I just need to know in general how to make the font size re sizable base on how visitors resize their browser windows.
let's say a div Width is 80% and Height is 20%, the div resizes as expected but the text within is unaffected whether I use font-size 100% or 1em.
From the top of my head:
This is not possible to do without Javascript. The idea of font in the web browser is to be fixed once it is fully loaded, resizing windows will not resize the font. There is no good UI reasoning in having it resized as the browser resized. Personally i find it better that the font is not resized, because when I resized, I simply want to hide some text or show some text. You are better off putting a zoom button, so the user can choose if he/she wants to enlarge the font size.
Now, I also did a Google Search. All of them points to javascript:
FitText.js plugin (FitText is a jQuery plugin that makes your font-sizes flexible, allowing headlines to automatically-expand to fit the available space): http://fittextjs.com/
Adapt.js - Adaptive CSS: http://adapt.960.gs/
Bookmarks