Change fontSize | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Change fontSize

Why the code doesn't work (in html <p id="text" >text text text<p> In js Add (addEventListener ) text.style.fontSize += 2 + 'px')

8th Nov 2021, 11:29 AM
golovastik
golovastik - avatar
4 Answers
+ 3
Can you please link your complete code? Put it on sololearn playground and link it here) From the snippets I cannot see what's going on.
8th Nov 2021, 11:38 AM
Lisa
Lisa - avatar
+ 2
Well you can try to change font in CSS.
8th Nov 2021, 11:53 AM
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika)
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika) - avatar
+ 1
We can use "getComputedStyle()" Next convert value "parseInt() " and get the value
8th Nov 2021, 12:13 PM
golovastik
golovastik - avatar
+ 1
Thanks everyone)
8th Nov 2021, 12:14 PM
golovastik
golovastik - avatar