Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28612

Re: Change font size in multiple classes

Subject Re: Change font size in multiple classes
Newsgroups comp.lang.javascript
References <l8-dnaGgOJ9fWXrInZ2dnUU7-VOdnZ2d@westnet.com.au> <font-size-20150903062100@ram.dialup.fu-berlin.de> <XnsA50A6E8843ADDeejj99@194.109.6.166>
From Andrew Poulos <ap_prog@hotmail.com>
Date 2015-09-03 20:39 +1000
Message-ID <cvOdnTKEy9vIvnXInZ2dnUU7-amdnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


On 3/09/2015 6:51 PM, Evertjan. wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) wrote on 03 Sep 2015 in
> comp.lang.javascript:
>
>> Andrew Poulos <ap_prog@hotmail.com> writes:
>>> Is one way "better" than the other or is there another way to do this?
>>
>>    Maybe you can use a JavaScript element right behind the
>>    style element to convert all the px values into em values
>>    (only once, when the page is loaded). When no contents has
>>    been displayed yet, this should be faster than when it is
>>    done later.
>
> Works fine, start with:
>
> body {font-size:62.5%;} // <http://pxtoem.com/>
>
> and
>
> temp = document.getElementsByTagName('*');
> for (el in temp)
>    if (temp[el].style && temp[el].style.fontSize)
>      temp[el].style.fontSize =
>        temp[el].style.fontSize.replace(/(\d)px/,'.$1em');
>

I'm having a little trouble getting it to work (but thanks for the way 
forward). So far I've changed
   temp = document.getElementsByTagName('*');
to
   temp = document.body.getElementsByTagName('*');

Andrew Poulos

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-03 13:55 +1000
  Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-03 10:09 +0200
  Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-03 10:51 +0200
    Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-03 20:39 +1000
      Re: Change font size in multiple classes Jake Jarvis <pig_in_shoes@yahoo.com> - 2015-09-03 16:20 +0200
        Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-03 16:27 +0200
          Re: Change font size in multiple classes Jake Jarvis <pig_in_shoes@yahoo.com> - 2015-09-03 16:30 +0200
            Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-03 16:39 +0200
              Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-04 15:49 +1000
                Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-04 09:37 +0200
                Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-04 18:11 +1000
                Re: Change font size in multiple classes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-07 03:33 +0200
      Re: Change font size in multiple classes "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-03 16:24 +0200
  Re: Change font size in multiple classes Dr J R Stockton <reply1500@merlyn.demon.co.uk.invalid> - 2015-09-05 20:49 +0100
    Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-06 19:30 +1000
      Re: Change font size in multiple classes Dr J R Stockton <reply1500@merlyn.demon.co.uk.invalid> - 2015-09-07 20:27 +0100
  Re: Change font size in multiple classes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-06 14:07 +0200
    Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-07 09:53 +1000
      Re: Change font size in multiple classes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-07 20:35 +0200
        Re: Change font size in multiple classes Andrew Poulos <ap_prog@hotmail.com> - 2015-09-08 14:18 +1000
          Re: Change font size in multiple classes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-09 04:51 +0200

csiph-web