HTML <wbr> Tag
The <wbr> tag is used to instruct the browser, where in the text a line-break could be added. Learn how to use <wbr> tag with syntax and examples.
The <wbr> tag is used to instruct the browser where in the text a line break could be added. Unlike the <br> tag, which obliges the browser to insert a line break, when <wbr> is used the browser first analyzes its content, and then inserts a line break if necessary (too long word or URL address).
In case you do not use the <wbr> tag, long words could either wrap in a wrong place (making it difficult to read), or not wrap at all - pushing the page layout to the side.
The <wbr> tag is one of the HTML5 elements.
A hyphen at the line breakpoint is not introduced by the <wbr> element. If you want a hyphen to occur only at the end of a line, use ­ (soft hyphen character entity).
You may not use this element frequently. But if you need it, the <wbr> will be really useful. Let’s look through the example below, where we have a file path.
HTML <wbr> Tag
<p>You can find the file by going
C:\user\docs\Letter.txt
</p>As you can see there isn’t any line-break opportunity, and the whole file path went to the next line. If you add <wbr> elements, the file path will break properly, while rendering that paragraph.
HTML <wbr> Tag
<p>You can find the file by going C:<wbr>\user<wbr>\docs<wbr>\Files<wbr>\Letter.txt</p>Syntax
The <wbr> tag is empty, which means that the closing tag isn’t required. But in XHTML, the (<wbr>) tag must be closed (<wbr/>).
Example of the HTML <wbr> tag:
HTML <wbr> Tag
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p>Example of a long string of text without wbr.</p>
<p>This is the longest word you can ever meet in the English language pneumonoultramicroscopicsilicovolcanoconiosis</p>
<p>Example of a long string of text with wbr.</p>
<p>This is the longest word you can ever meet in the English language pneumono<wbr />ultra<wbr />micro<wbr />scopic<wbr />silico<wbr />volcano<wbr />coniosis</p>
</body>
</html>Result

Attributes
The <wbr> tag supports the Global attributes and the Event Attributes.
Practice
What is the primary use of the <wbr> tag in HTML?