Latest web development tutorials

JavaScript fontsize () method

String Object Reference JavaScript String Object

Definition and Usage

fontsize () method is used in accordance with the specified size to display the string.

This method returns a string plus <font> tag, as follows:

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

grammar

string.fontsize(size)

参数 描述
size 必须. size 参数必须是从 1 至 7 的数字。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support fontsize () methods.


Examples

Examples

Using the specified size to display the string:

<script>

var str = "Hello world!";
document.write(str.fontsize(7));

</script>

try it"


String Object Reference JavaScript String Object