The first method: divided into large and medium-sized control body font size, generally need to specify the ID
<textarea id="runcode82882"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <ptmL> <pead> <meta http-equiv=" Content-type " Content= "text/html; charset=gb2312 "/> </pead> <style> #content {font-size:12px; line-height:200%; padding:10px; } </style> <script language= "JavaScript" > function setfont (size) {var obj; Obj=document.getelementbyid ("content"); Obj.style.fontsize=size; Obj.style.color= "#ff0000"; } </script> <body> <div> font: Small Medium large </div> <div id= "Content" > cloud-Habitat Community www.jb51.net welcome you all. </div> </body> </ptmL></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
The second method, not much, with special needs can be used. This is to set all the size settings in the body, as the above code controls the text font size. We can choose according to their own needs. Pay attention to multiple tests.
<textarea id="runcode49669"><script> var TGS = new Array (' div ', ' TD ', ' TR '); var Szs = new Array (' Xx-small ', ' x-small ', ' small ', ' medium ', ' large ', ' x-large ', ' xx-large '); var Startsz = 2; function ts (trgt,inc) {if (!document.getelementbyid) return var d = document,cel = Null,sz = Startsz,i,j,ctags; SZ + Inc; if (SZ < 0) Sz = 0; if (SZ > 6) SZ = 6; Startsz = sz; if (! (CEl = d.getElementById (TRGT))) CEl = D.getelementsbytagname (TRGT) [0]; CEl.style.fontSize = szs[sz]; for (i = 0; i < tgs.length i++) {cTags = Cel.getelementsbytagname (tgs[i)); for (j = 0; J < Ctags.length J + +) ctags[J].style.fontsize = szs[sz]; } </script> <style>. tabfont{font-size:12px} </style> <body> + enlarge Font | + Decrease Font Cloud Habitat Community www.jb51.net This is to set all size settings in the body, as the above code controls the font size of the text. We can choose according to their own needs. Pay attention to multiple tests. </body></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
The third method: only increase the reduction of two methods, but very practical, this site is also used in this way
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <ptmL> <pead> <meta http-equiv=" Content-type " Content= "text/html; charset=gb2312 "/> </pead> <style> #content {font-size:12px; line-height:200%; padding:10px; } </style> <script language= "JavaScript" >//change font size var status0= '; var curfontsize=10; var curlineheight=18; function Turnsmall () {if (curfontsize>10) {document.getElementById (' art_content '). Style.fontsize= (--curfontsize ) + ' PT '; document.getElementById (' art_content '). style.lineheight= (--curlineheight) + ' PT '; }} function Turnbig () {if (curfontsize<28) {document.getElementById (' art_content '). Style.fontsize= (++curfontsize ) + ' PT '; document.getElementById (' art_content '). style.lineheight= (++curlineheight) + ' PT '; } </script> <body> font: [Increase decrease] <div id= "Art_contenT "> Cloud Community Test Text Code </div> </body> </ptmL>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]