html
  1. html-wbr-tag

HTML <wbr> Tag

The HTML <wbr> tag is a non-visible tag that specifies where the line can be broken, if needed, to prevent the text from being wider than the containing element. It stands for "word break opportunity".

Syntax

The syntax for the HTML <wbr> tag is:

<wbr>

Example

Consider the following example code snippet:

<p>LongWordContainingNoSpaces<wbr>BreakHere</p>
Try Playground

Explanation

The <wbr> tag is used to specify the point where a line break can occur in a long word in order to prevent the text from being wider than the containing element. It is a non-visible tag that can be used only in block-level elements.

Use

The <wbr> tag is particularly useful in situations where long strings of text need to be displayed in a limited amount of space, such as in navigation menus or table cells.

Important Points

  • The <wbr> tag is useful for providing hints to the browser about where to break a long word to prevent overflow.
  • It can only be used in block-level elements.
  • It does not add any visible line breaks or spaces to the text.

Summary

The <wbr> tag in HTML is a useful tool for preventing text overflow in a limited amount of space. It provides a hint to the browser about where to break a long word. While it is not visible on the page, it can make a significant difference in the readability and usability of your content.

Published on: