<wbr>

The HTML <wbr> element indicates a potential line break within text, enabling the browser to break the line at that location if necessary, thereby enhancing text wrapping and readability.

<wbr> Tag

The <wbr> element in HTML specifies a possible line break, allowing the browser to wrap text at that point when necessary. This is especially useful for handling long words or uninterrupted text strings that might overflow their container.

Syntax

index.html
<wbr>

<wbr> Demo

A demonstration of text wrapping at suggested breakpoints:

The wbr element

Resize the browser window to see how the long word in the paragraph below breaks:

This is a veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongwordthatwillbreakatspecificplaceswhenthebrowserwindowisresized.

index.html
<h1>The wbr element</h1>
<p>Resize the browser window to see how the long word in the paragraph below breaks:</p>
<p>This is a veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryvery<wbr>longwordthatwillbreakatspecific<wbr>placeswhenthebrowserwindowisresized.</p>

Definition and Usage

The <wbr> (Word Break Opportunity) tag provides hints to the browser about where a word can be broken if required for better text wrapping.

When dealing with long words or URLs, <wbr> can suggest ideal places for a line break, preventing awkward text overflow.

Attributes

The <wbr> element supports global attributes.

Conclusion

The <wbr> tag is a helpful tool for controlling text wrapping, particularly in cases of long words or continuous text strings. It does not force a line break but allows the browser to determine an appropriate break point when needed. Using <wbr> enhances text readability across various screen sizes and layouts.