String.prototype.big()

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

String 值的 big() 方法创建一个 <big> 元素字符串,其中嵌入了调用的字符串(<big>str</big>),从而使该字符串以大字体显示。

备注: 所有的 HTML 包装方法都已被弃用,并且仅为了兼容性而标准化。对于 big() 方法来说,在 HTML5 中已经移除了 <big> 元素,不应再使用它。Web 开发者应该使用 CSS 属性来实现相应的效果。

语法

js
big()

参数

无。

返回值

一个以 <big> 开始标签开头的字符串,然后是文本 str,最后是 </big> 结束标签。

示例

使用 big()

下面的例子使用了字符串方法来改变一个字符串的字体大小:

js
const worldString = "Hello, world";

console.log(worldString.small()); // <small>Hello, world</small>
console.log(worldString.big()); // <big>Hello, world</big>
console.log(worldString.fontsize(7)); // <font size="7">Hello, world</font>

使用 element.style 对象,你能更通用地获得和操作该元素的 style 属性,例如:

js
document.getElementById("yourElemId").style.fontSize = "2em";

规范

Specification
ECMAScript® 2025 Language Specification
# sec-string.prototype.big

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
big
Deprecated

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Deprecated. Not for use in new websites.

参见