Limited supportAvoid in modern code. They are legacy conveniences that obscure how HTML is being produced.

Overview

String HTML wrapper methods such as bold() and link() are legacy helpers that generate HTML strings. Modern code should build markup through templates or DOM APIs with clearer intent.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
1
1
18
1
Built-in object
String.big
Deprecated

The big() method of String values creates a string that embeds this string in a big element (str), which causes this string to be displayed in a big font.

1
12
1
1
18
1
String.blink
Deprecated

The blink() method of String values creates a string that embeds this string in a element (str), which used to cause a string to blink in old browsers.

1
12
1
1
18
1
String.bold
Deprecated

The bold() method of String values creates a string that embeds this string in a b element (str), which causes this string to be displayed as bold.

1
12
1
1
18
1
String.fixed
Deprecated

The fixed() method of String values creates a string that embeds this string in a tt element (str), which causes this string to be displayed in a fixed-width font.

1
12
1
1
18
1

The fontcolor() method of String values creates a string that embeds this string in a font element (str), which causes this string to be displayed in the specified font color.

1
12
1
1
18
1

The fontsize() method of String values creates a string that embeds this string in a font element (str), which causes this string to be displayed in the specified font size.

1
12
1
1
18
1
String.italics
Deprecated

The italics() method of String values creates a string that embeds this string in an i element (str), which causes this string to be displayed as italic.

1
12
1
1
18
1
String.link
Deprecated

The link() method of String values creates a string that embeds this string in an a element (str), to be used as a hypertext link to another URL.

1
12
1
1
18
1
String.small
Deprecated

The small() method of String values creates a string that embeds this string in a small element (str), which causes this string to be displayed in a small font.

1
12
1
1
18
1
String.strike
Deprecated

The strike() method of String values creates a string that embeds this string in a strike element (str), which causes this string to be displayed as struck-out text.

1
12
1
1
18
1
String.sub
Deprecated

The sub() method of String values creates a string that embeds this string in a sub element (str), which causes this string to be displayed as subscript.

1
12
1
1
18
1
String.substr
Deprecated

The substr() method of String values returns a portion of this string, starting at the specified index and extending for a given number of characters afterwards.

1
12
1
1
18
1
String.sup
Deprecated

The sup() method of String values creates a string that embeds this string in a sup element (str), which causes this string to be displayed as superscript.

1
12
1
1
18
1
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • Starting with version 17, the quotation mark (") is replaced by its HTML reference character (`"`) in strings supplied for the `name` parameter.

Syntax

JAVASCRIPT
// HTML wrapper methods example
// See MDN Web Docs for details

Live demo

Wrap text with bold and italics

Use legacy string wrapper methods that return HTML strings.

JavaScript
Output
Press the Run button

Create an anchor tag string

Use String.prototype.link to produce a legacy HTML snippet.

JavaScript
Output
Press the Run button

Compare with template literals

See the same HTML built with a modern explicit template string.

JavaScript
Output
Press the Run button

Use cases

  • Legacy string cleanup

    Replace wrapper-method output with explicit templates or DOM updates during modernization work.

  • Reading old examples

    Understand wrapper methods when maintaining historical snippets or browser-era tutorials.

Cautions

  • HTML-generating string helpers blur the boundary between text and markup and are easy to misuse.
  • Prefer explicit rendering paths that are easier to sanitize, review, and localize.

Accessibility

  • Generated HTML still needs semantic structure and safe rendering rules.
  • String-based markup construction can hide accessibility issues until late in review.

Powered by web-features