- The HTML
<wbr>tag is used for specifying a line break opportunity.
<wbr>tag can be used on very long words or other long strings of text with no spaces. Without the
<wbr>tag, these long strings of text could either wrap in strange place (making it difficult to read), or not wrap at all - inadvertently pushing the page layout to the side (again, making it difficult to read and view the document as intended).
- The difference between the
<wbr>tag and the
<br>tag is that the
<br>tag forces a line break. The
<wbr>tag, on the other hand, simply represents a line breakopportunity - the browser should only render a line-break if necessary.
<wbr>tag is an empty tag. In other words, it has no end tag.
- The <wbr> tag is supported in all major browsers, except Internet Explorer.
Example 1 :
<html> <head><title>mark tag in html5</title> </head> <body> <b>Below is the text with wbr tag, which tells browser to apply line break</b> <p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<wbr>aaaa</wbr>aaaaaaaaaaaaaaaaaaaaa</p><br /> <b>Below text does not wrap. This text causes scroll-bar to appear.</b> <p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p> </body> </html>
In the above example, we have shown how to use wbr element in html5.