String.prototype.fixed()
Deprecated
Avoid using this feature in new projects. HTML wrapper methods exist only for backwards compatibility. Use DOM APIs to create elements instead. This feature may be a candidate for removal from web standards or browsers. >
Consider using the following features instead: DOM. >
fixed() 㯠String å¤ã®ã¡ã½ããã§ããã®æååã <tt> è¦ç´ ã«åã込㿠(<tt>str</tt>)ããã®æååãåºå®å¹
ãã©ã³ãã§è¡¨ç¤ºããããããªæååãçæãã¾ãã
ã¡ã¢:
HTML ã©ããã¼ã¡ã½ããã¯ãã¹ã¦éæ¨å¥¨ã¨ãªã£ã¦ãããäºææ§ç®çã®ã¿ã§æ¨æºåããã¦ãã¾ãã fixed() ã®å ´åã <tt> è¦ç´ èªä½ã HTML 仿§ããé¤å»ããã使ç¨ã§ããªããªãã¾ãããã¦ã§ãéçºè
ã¯ã代ããã« CSS ããããã£ã使ç¨ãã¦ãã ããã
æ§æ
fixed()
弿°
ãªãã
è¿å¤
<tt> éå§ã¿ã°ã§å§ã¾ããstr ã®ããã¹ããæ¥ã¦ã </tt> çµäºã¿ã°ãæ¥ãæååã§ãã
ä¾
>fixed() ã®ä½¿ç¨
以ä¸ã®ã³ã¼ãã¯ã HTML æååã使ãããããææ¸ã®æ¬ä½ã«ç½®ãæãã¾ãã
const contentString = "Hello, world";
document.body.innerHTML = contentString.fixed();
ããã«ãããæ¬¡ã® HTML ãçæããã¾ãã
<tt>Hello, world</tt>
è¦å:
ãã®ãã¼ã¯ã¢ããã¯ãtt ãæå¹ãªè¦ç´ ã§ãªããªã£ãããã䏿£ã§ãã
fixed() ã使ç¨ã㦠HTML ããã¹ããç´æ¥ä½æãã代ããã«ãCSS ã使ç¨ãã¦ãã©ã³ããæä½ãã¦ãã ãããä¾ãã°ã element.style 屿§ã使ç¨ãã¦ã font-family ãæä½ãããã¨ãã§ãã¾ãã
document.getElementById("yourElemId").style.fontFamily = "monospace";
仿§æ¸
| 仿§æ¸ |
|---|
| ECMAScript® 2027 Language Specification > # sec-string.prototype.fixed > |