change text-font size of whole page content
You can use rem
, which is better than em
in some places because em
cascades and rem
does not.
With all lengths are specified in rem
, you can adjust the sizes by change the font-size of the <html>
element.
See also: http://snook.ca/archives/html_and_css/font-size-with-rem
Worked for me:
function changeFont(element){
element.setAttribute("style",element.getAttribute("style")+";font-family: Courier New");
for(var i=0; i < element.children.length; i++){
changeFont(element.children[i]);
}
}
changeFont(document.getElementsByTagName("body")[0]);
Add an id to the body
tag and then go ahead and change it's font size with JavaScript. This will change the font size for every element inside your webpage! It is as simple as that!