String.prototype.italics()

已弃用: 不再推荐使用该特性。虽然一些浏览器仍然支持它,但也许已从相关的 web 标准中移除,也许正准备移除或出于兼容性而保留。请尽量不要使用该特性,并更新现有的代码;参见本页面底部的兼容性表格以指导你作出决定。请注意,该特性随时可能无法正常工作。

The italics() method creates an <i> HTML element that causes a string to be italic.

Syntax

str.italics()

Description

The italics() method embeds a string in an <i> tag: "<i>str</i>".

Examples

Using italics()

The following example uses string methods to change the formatting of a string:

var worldString = 'Hello, world'; console.log(worldString.blink());  // Hello, world
console.log(worldString.bold());  // Hello, world
console.log(worldString.italics()); //Hello, world
console.log(worldString.strike());  // Hello, world

Specifications

Specification
ECMAScript Language Specification
# sec-string.prototype.italics

浏览器兼容性

BCD tables only load in the browser

See also