HTML <wbr>
tag
The <wbr>
tag is used to specify a word break opportunity within a block of text. This allows browsers to break lines at specific points, improving the readability of long strings of text.
Basic Usage
To use the <wbr>
tag, simply insert it at the point where you want a word break opportunity to occur:
Thisisaverylongword<wbr>thatshouldbebroken
In the above example, the browser is allowed to break the long word at the point where the <wbr>
tag is placed.
Tag Attributes
Below is a table showing the main attributes of the <wbr>
tag and their use:
Attribute | Description |
---|---|
clear |
Specifies the side of the element where other floating objects are not allowed. |
class |
Specifies one or more class names for an element (refers to a class in a style sheet). |
id |
Specifies a unique id for an element. |
Example
Here's an example using the <wbr>
tag with the clear
attribute:
Thisisaverylongword<wbr clear="left">thatshouldbebroken
In this example, the browser will not allow floating objects on the left side of the element where the <wbr>
tag is placed.