String.prototype.small() is a deprecated HTML wrapper method (same API as MDN String.prototype.small()). It returns a string that wraps your text in a <small> tag. Learn what it builds, why wrappers are discouraged, and how to replace them with DOM APIs or CSS — with five examples and try-it labs.
01
Kind
Instance method
02
Returns
HTML string
03
Status
Deprecated
04
Params
None
05
Mutates?
No
06
Prefer
createElement
Fundamentals
Introduction
Early JavaScript included helpers that wrapped text in HTML tags — small(), big(), bold(), italics(), and others. They made it easy to inject markup with innerHTML.
Today those wrappers are deprecated. small() still works in browsers for compatibility. The <small>element remains valid HTML (fine print / side comments), but you should create it with the DOM — not by concatenating tags as a string.
💡
Learn it, don’t ship it
Study small() so you can recognize legacy code. For new pages, use document.createElement("small") or a CSS class for smaller text.
You get a live element, safer text assignment via textContent, and markup that matches modern HTML practice. Use CSS font-size when you only need smaller visual size without fine-print semantics.
Applications
🚀 Common Use Cases
Reading legacy tutorials — recognize HTML wrapper methods in old samples.
Migrating old scripts — replace small() with createElement("small").
Fine print / disclaimers — use a real <small> element (not the string method).
Teaching string immutability — show that methods return new strings.
Not for new apps — do not use small() to shrink UI text.
Safer markup — prefer textContent + DOM over innerHTML strings.
🧠 How small() Builds Markup
1
Start with text
You call str.small() on a string receiver.
Input
2
Wrap with tags
Concatenate <small> + text + </small>.
Wrap
3
Return an HTML string
No DOM node is created — only text markup.
Result
4
⚠️
Prefer the DOM instead
Create a real <small> with createElement.
Important
📝 Notes
small() is deprecated — standardized only for compatibility.
The <small>element is still valid HTML; the string method is not recommended.
It returns a string, not a DOM node.
It takes no parameters.
Other HTML wrappers (big(), bold(), fontcolor(), …) share the same fate.
Avoid assigning untrusted strings to innerHTML.
Compatibility
Browser & Runtime Support
String.prototype.small() is still widely implemented for compatibility, but it is deprecated. Do not use it in new projects.
✓ Deprecated · Legacy
String.small()
Available in modern browsers for old code, but MDN recommends document.createElement("small") instead.
LegacyCompatibility only
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
small()Avoid in new code
Bottom line: Recognize small() in legacy samples. For new UI, create a real element with the DOM — or use CSS font-size when size is only visual.
Wrap Up
Conclusion
String.prototype.small() builds a <small>...</small> HTML string. It is useful for understanding history and migrating old code — not for writing new features.
Confuse the valid <small> element with the deprecated method
Inject untrusted small() output via innerHTML
Expect small() to return a live element
Mix HTML wrappers with modern component frameworks
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about String.small()
Deprecated HTML wrapper — prefer createElement.
5
Core concepts
📝01
Returns
HTML string
API
⚠️02
Status
deprecated
Legacy
✅03
Element
still valid
HTML
✓04
Replace
createElement
Modern
⚡05
Mutates
no
Immutable
❓ Frequently Asked Questions
String.prototype.small() returns an HTML string that wraps the text in a <small> element — for example "Hello".small() returns '<small>Hello</small>'. It takes no parameters.
Yes. MDN marks all HTML wrapper methods as deprecated. Prefer document.createElement("small") or CSS font-size instead of building markup with string methods.
Yes. Unlike <big>, the <small> element remains in HTML for side comments and fine print. What is deprecated is the String.small() helper that builds that markup as a string.
No. Strings are immutable. small() returns a new string containing HTML markup. The original text stays the same.
Use document.createElement("small") and set textContent, or style an element with CSS font-size / a utility class. Avoid injecting string-built HTML via innerHTML when you can create real nodes.
It remains widely available for compatibility, but you should not use it in new code.
Did you know?
HTML once had both <big> and <small> for relative font size. <small> survived with a semantic meaning (side comments / fine print), while <big> was removed — yet String.prototype.small() is still a deprecated string helper, just like big().