[nycphp-talk] Good Font Size Control
Andy Dirnberger
dirn at dirnonline.com
Wed Aug 8 23:20:48 EDT 2007
> Changing the font-size of the body has no effect on text within td
> elements. Changing the font-size on td elements has no effect on form
> input elements like buttons. Etc, etc, etc. This problem can't be
> *that* hard. Is there really no better way to control font-size of all
> page elements simultaneously?
To control font size at a global CSS level, try:
* { font-size : XX; }
For a JavaScript way of changing font size (using the above), I use
something like (note that n is populated by clicking buttons corresponding
to values 10, 12, and 14):
function adjustText (n) {
for (var i = 0; i < document.styleSheets.length; i++) {
for (var j = 0; j < document.styleSheets [i].rules.length; j++) {
if (document.styleSheets [i].rules [j].selectorText == "*" ||
document.styleSheets [i].rules [j].selectorText == "") {
// Set new size
document.styleSheets [i].rules [j].style.fontSize = (n + "pt");
return;
}
}
}
}
This may not be exactly what you're looking for, but it's hopefully a good
start.
More information about the talk
mailing list