JavaScript String fontsize() Method

Definition and Usage

The String fontsize() method in JavaScript is deprecated.

Avoid using it.

It may stop running in your browser at any time.

fontsize() The method returns a string embedded in <font> tags:

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

HTML5 does not support the <font> tag.

Example

let text = "Hello World!";
let result = text.fontsize(6);

Try It Yourself

Syntax

string.fontsize(size)

Parameter

Parameter Description
size Required. Font size. An integer between 1 and 7.

Return Value

String embedded in the <font> tag.