<nobr>
<nobr>
Tag
The <nobr>
tag prevents text from breaking into multiple lines, keeping it on a single line. If the content exceeds the available space, a horizontal scrollbar appears instead of wrapping. Unlike standard text behavior, which naturally moves to the next line, <nobr>
enforces continuous text display.
Syntax
<nobr>This text will not break into multiple lines.</nobr>
<nobr>
Demo
<p>
<nobr>
This is a long line of text that will not wrap even if it extends beyond the width of the container.
</nobr>
</p>
Key Points
- Purpose: Prevents text from wrapping and forces it to stay on a single line.
- Deprecated: The
<nobr>
tag is obsolete and should not be used in modern web development. - Modern Alternative: Use CSS properties like
white-space: nowrap;
to achieve the same effect.
Conclusion
The <nobr>
tag was historically used to prevent text wrapping, but it is now deprecated in HTML. Instead, using CSS (white-space: nowrap;
) is the preferred approach, offering better flexibility and compatibility across browsers. While <nobr>
may still function, it is not recommended for modern web development due to its outdated nature.