HTML <wbr> tag

<wbr> (Word BReak) means: "The browser may insert a line break here, if it wishes." If the browser does not think a line break necessary nothing happens.

The tag can be used in many different cases as follows:

  • A word is so long that a horizontal scrollbar has to be displayed at the bottom of the browser window, e.g. a long Java class name or a long function name. In order to prevent the horizontal scrollbar being displayed, one or more <wbr> can be inserted into the word. Below is an example:
    <div class="name">getElements<wbr>ByTagName()</div>
  • In a text block embraced by HTML tag <nobr>, <wbr> can force a line break if needed.

If you want to use this tag, you should pay attention to browser compatibility on this tag. The article The wbr tag provides a thorough compatibility table and some interesting test.