How To Use String Object FontSize In JavaScript

In this article I am going to explain about String Object FontSize In JavaScript.
  • 1276

Use fontsize() method in JavaScript

If we want to display a string in a specified size then we can use a fontsize() method.

The <font> tag is used to return a string in JavaScript, like this:

<font size="size">string</font>

All browsers support string object fontsize() method.

Syntax

string.fontsize(size)

Example

<!DOCTYPE html>

<html>

<body Style="background-color:red">

 

<p id="demo">Click here</p>

<button onclick="myFunction()">Try it</button>

<script type="text/javascript">

    function myFunction()

    {

        var txt = "Fontsize:Hello World";

        document.getElementById("demo").innerHTML = txt.fontsize(6);  

    }

</script>

</body>

</html>

Output1

 op1.jpg

Output2

 op2.jpg

Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.