String.prototype.small()
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.>
String 값의 small() 메서드는 문자열을 작은 폰트로 표시되도록 하는 <small> 요소(<small>str</small>)에 안에 들어가는 문자열을 생성합니다.
참고 :
모든 HTML 래퍼 메서드는 더 이상 사용되지 않으며 호환성 목적으로만 표준화되었습니다. 대신 document.createElement()와 같은 DOM API를 사용하시기 바랍니다.
구문
js
small()
매개변수
없음.
반환 값
<small> 시작 태그로 시작한 다음 str 내용이 이어지고, 그 후 </small> 태그로 끝마치는 문자열
예제
>small() 사용하기
아래 코드는 HTML 문자열을 생성한 다음 document의 body를 해당 문자열로 대체합니다.
js
const contentString = "Hello, world";
document.body.innerHTML = contentString.small();
이는 다음과 같은 HTML을 생성합니다.
html
<small>Hello, world</small>
small()를 사용하여 HTML 텍스트를 직접 작성하는 대신 document.createElement()와 같은 DOM API를 사용해야 합니다. 아래의 예를 참고하세요.
js
const contentString = "Hello, world";
const elem = document.createElement("small");
elem.innerText = contentString;
document.body.appendChild(elem);
명세서
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-string.prototype.small> |