Tag wbr

🔀 HTML <wbr> Tag — Word Break Opportunity

The <wbr> (Word Break Opportunity) tag in HTML is a self-closing inline element that indicates a position within a word where the browser may optionally break a line if needed. It helps improve text wrapping and readability, especially with long words or URLs.


📌 What Is the <wbr> Tag?

  • Stands for Word Break Opportunity.
  • Suggests a place where the browser can break a word and wrap text onto the next line.
  • Useful to prevent overflow or horizontal scrolling caused by long strings without spaces.
  • Does not force a line break; it only offers a potential break point.
  • Supported in modern browsers.

✅ Basic Syntax

<p>ThisIsAReallyLongWord<wbr>ThatMightNeedBreaking</p>

In this example, the browser can break the word at the <wbr> position if necessary.


🧪 Example: Breaking Long URLs

<p>Check this link: https://www.example.com/verylong<wbr>path<wbr>to<wbr>resource</p>

If the URL is too long to fit on one line, the browser may break it at the <wbr> points to avoid overflow.


🎨 Why Use <wbr>?

  • Improves layout on small screens or narrow containers.
  • Prevents ugly horizontal scrollbars from unbreakable long text.
  • Keeps text readable without inserting visible characters.
  • More elegant than inserting zero-width spaces or hyphens manually.

⚠️ Things to Remember

  • <wbr> only suggests break points; the browser decides whether to break.
  • Avoid overusing <wbr> unnecessarily; use it where line breaks are logical.
  • It is self-closing and does not require a closing tag.
  • Works best combined with CSS properties like word-wrap: break-word; or overflow-wrap: break-word;.

🏁 Summary

The <wbr> tag is a helpful tool for indicating optional line break opportunities inside long words or URLs, enhancing readability and layout flexibility without inserting visible characters.