Tag nobr

The <nobr> tag is an obsolete HTML element that was once used to prevent line breaks within its content. Although it still works in some browsers for legacy reasons, it is not part of the official HTML standard and should be avoided in modern web development.


⚠️ What Is <nobr>?

The <nobr> tag was designed to keep text on a single line, regardless of the container’s width.

<nobr>This is unbreakable text</nobr>

🔴 Result: The text will never wrap to a new line, even if it overflows the container.


🚫 Why <nobr> Is Obsolete

  • ❌ Not in the HTML5 specification
  • ❌ Not semantic
  • ❌ Poor accessibility
  • ❌ Replaced by better CSS solutions

⚠️ Do not use <nobr> in modern projects. Use CSS instead.


✅ Modern Alternative: white-space: nowrap;

To achieve the same effect with modern HTML and CSS:

<span class="no-wrap">This is unbreakable text</span>
cssCopyEdit.no-wrap {
  white-space: nowrap;
}

This is standards-compliantaccessible, and fully supported.


🧪 Example: Preventing a Line Break

❌ Obsolete (Don’t use):

<nobr>Price: $1,000.00</nobr>

✅ Modern:

<span style="white-space: nowrap;">Price: $1,000.00</span>

🧠 When You Might Need nowrap

Use CaseRecommendation
💰 Prices, currencywhite-space: nowrap;
📅 Dates and time (e.g. “June 14, 2025”)Use CSS, not <nobr>
💳 Credit card numbersUse <span class="no-wrap">

📜 Browser Support

Browser<nobr> Works?Recommended?
Chrome✅ (legacy)
Firefox✅ (legacy)
Safari✅ (legacy)
Mobile✅ (legacy)

🧩 Even though it still works, using <nobr> is like using <font> — it’s a relic of the past.


🧾 Summary

Feature<nobr>CSS Alternative
Standard?❌ No✅ Yes
Semantic?❌ No✅ Better control with classes
Accessible?❌ Poor✅ Full control with ARIA
Styling?❌ Hard to customize✅ Fully customizable

✅ Conclusion

The <nobr> tag belongs to deprecated HTML history. While it technically works, it should not be used in modern web development. Use white-space: nowrap; in CSS for a reliable, flexible, and semantic solution.

✨ Write modern HTML. Leave <nobr> in the past.