JavaScript italics()Method

String 对象参考手册JavaScript String Object

Definition and Usage

The italics() method is used to display a string in italic.

This method returns the string wrapped in an <i> tag, as shown below:

<i>string</i>

Syntax

string.italics()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the italics() method.


Example

Example

Display a string in italic:

<script>

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

</script>

Try it Yourself »


String 对象参考手册JavaScript String Object Other Extensions