HTML wbr Tag

HTML wbr Tag

HTML <wbr> Tag


The <wbr> tag is used to instruct the browser, wherein 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 analyze its content, and then insert 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 no wrap at all - pushing the page layout to the side.
The <wbr> tag is one of the HTML5 elements.

Syntax

The <wbr> tag is an empty tag, the closing </wbr> can be omitted.

Example

<!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>
    </p>
  </body>
</html>

Result

wbr tag example

Attributes

The <wbr> tag supports the Global attributes and the Event Attributes.
Reactions

Post a Comment

0 Comments

close