String.prototype.small()

非推奨;: この機能は非推奨になりました。まだ対応しているブラウザーがあるかもしれませんが、すでに関連するウェブ標準から削除されているか、削除の手続き中であるか、互換性のためだけに残されている可能性があります。使用を避け、できれば既存のコードは更新してください。このページの下部にある互換性一覧表を見て判断してください。この機能は突然動作しなくなる可能性があることに注意してください。

small() メソッドは、文字列を <small> 要素に埋め込んだ文字列 (<small>str</small>) を生成し、文字列が小さなフォントで表示されるようにします。

警告: HTML ラッパーメソッドはすべて非推奨となっており、互換性目的のみで標準化されています。代わりに DOM APIdocument.createElement() などを使用してください。

構文

js
small()

返値

開始タグ <small> で始まり、テキスト str が来て、終了タグ </small> が来る文字列です。

small() の使用

以下の例では文字列のメソッドを使用して、文字列の大きさを変更しています。

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</fontsize>

element.style オブジェクトを使用すると、要素の style 属性を使用して、次のようにもっと汎用的に操作することができます。

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

仕様書

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

ブラウザーの互換性

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
small
Deprecated

Legend

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

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

関連情報