Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28625
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Subject | Re: Change font size in multiple classes |
| Newsgroups | comp.lang.javascript |
| References | (3 earlier) <cvOdnTKEy9vIvnXInZ2dnUU7-amdnZ2d@westnet.com.au> <ms9ks0$mgb$1@dont-email.me> <XnsA50AA7739D4CFeejj99@194.109.6.166> <ms9lfo$otq$1@dont-email.me> <XnsA50AA989965EAeejj99@194.109.6.166> |
| Date | 2015-09-04 15:49 +1000 |
| Message-ID | <SoydnUOUHLpkrXTInZ2dnUU7-WmdnZ2d@westnet.com.au> (permalink) |
On 4/09/2015 12:39 AM, Evertjan. wrote:
> Jake Jarvis <pig_in_shoes@yahoo.com> wrote on 03 Sep 2015 in
> comp.lang.javascript:
>
>>>> That style property reflects *inline* styles.
>>>
>>> Yes, because that was the OQ asked by the OP.
>>>
>>
>> What?
>> No ...
>
> Indeed, Andrew said 'class attribute', my mistake:
>
> Andrew Poulos <ap_prog@hotmail.com> wrote on 03 Sep 2015 in
> comp.lang.javascript:
>> When I look at the publish source I note that every piece of text is
>> wrapped in a SPAN which has a class attribute.
>
> However, whether you change only the inline styles or also the
> classes and id styles, you would have to assertain that you are only
> changing text, not images and other element-sizes. Otherwise zooming would
> do just fine.
>
> So perhaps keeping to the <span> elements would be safest for now ;-)
I'm now trying this and it seems to be ok (not working in IE 8):
var i,
j,
len,
rules;
for (j = 0; j < document.styleSheets.length; j++) {
rules = document.styleSheets[j].cssRules;
len = rules.length;
for (i = 0; i < len; i++) {
if ( /font-size/.test(rules[i].cssText) ) {
rules[i].style.fontSize =
(parseInt(rules[i].style.fontSize, 10) / 16) + "em";
}
}
}
document.body.style.fontSize = "100%";
I search for font-size rules and then convert any to EMs based on 16
pixels equals 1 em (the app only ever publishes font sizes in pixels).
Andrew Poulos
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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