How to change the font size of a text using JavaScript?

JavascriptWeb DevelopmentFront End Technology

This method causes a string to be displayed in the specified size as if it were in a <font size= "size"> tag.

Example

You can try to run the following code to change the font size of a text using JavaScript −

Live Demo

<html>
   <head>
      <title>JavaScript String fontsize() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Demo Text");
         document.write(str.fontsize(10));
         alert(str.fontsize( 10 ));
      </script>
   </body>
</html>
raja
Published on 06-Feb-2018 19:26:24
Advertisements