3 min read
ā¢Question 42 of 49easyWhat is the WBR Element?
Word break opportunities.
What You'll Learn
- Using the wbr element
- When to allow breaks
- Difference from br
The WBR Element
The <wbr> element suggests a word break opportunity. The browser can break the line at this point if needed, but won't if there's enough space.
Key Difference
| Element | Behavior |
|---|---|
<br> | Always breaks |
<wbr> | Breaks only if needed |
Examples
index.htmlHTML
<!-- Long URL -->
<p>Visit: https://example.com/<wbr>long/<wbr>path/<wbr>to/<wbr>page</p>
<!-- Long technical term -->
<p>The error was <code>Null<wbr>Pointer<wbr>Exception</code>.</p>
<!-- Long compound word -->
<p>The German word Donau<wbr>dampf<wbr>schiff<wbr>fahrt</p>Use Cases
- Long URLs
- Technical terms
- Compound words
- Strings that might overflow