HTML <wbr> Tag

The HTML <wbr> tag represents a line breaking opportunity.

A "line breaking opportunity" refers to a place in a word or string of text that could wrap to another line, but only if it needs to.

The <wbr> element can be used to specify the best parts of a word to wrap. It will only wrap if necessary (i.e. if the word is too long to fit inside its container). If wrapping isn't necessary, the word won't wrap.

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 break opportunity - the browser should only render a line-break if necessary.

Syntax

The <wbr> tag is written as <wbr> (no end tag). It is placed wherever a line breaking opportunity exists.

Like this:

Examples

Basic tag usage

Here's what it looks like without using the <wbr> tag...

Attributes

Attributes can be added to an HTML element to provide more information about how the element should appear or behave.

The <wbr> element accepts the following attributes.

AttributeDescription
None 

Global Attributes

The following attributes are standard across all HTML elements. Therefore, you can use these attributes with the <wbr> tag , as well as with all other HTML tags.

For a full explanation of these attributes, see HTML 5 global attributes.

Event Handlers

Event handler content attributes enable you to invoke a script from within your HTML. The script is invoked when a certain "event" occurs. Each event handler content attribute deals with a different event.

Most event handler content attributes can be used on all HTML elements, but some event handlers have specific rules around when they can be used and which elements they are applicable to.

For more detail, see HTML event handler content attributes.