HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: wbr

The wbr tag is a non-standard HTML tag that stands for "word break opportunity". It is used to indicate to web browsers where it is acceptable to break a word if necessary to prevent it from overflowing its container.

When a web page is displayed on a device with a smaller screen or a narrower viewport, the text may not fit within the available space. In such cases, the browser may break a word in the middle, which can make the text difficult to read. The wbr tag provides a way to indicate to the browser where it is acceptable to break a word, so that the text remains readable.

The wbr tag is an inline element, which means that it can be used within a paragraph, a heading, or any other inline element. It does not require a closing tag, and can be used as a self-closing tag.

Code Examples

Here are some examples of how the wbr tag can be used:

  • <p>This is a long word that can be broken using the <wbr> tag: supercalifragilisticexpialidocious</p>
  • <h1>This is a heading that can be broken using the <wbr> tag: The quick brown fox jumped over the lazy dog.</h1>
  • <a href="https://www.example.com">This is a link that can be broken using the <wbr> tag: www.example.com</a>

In each of these examples, the wbr tag is used to indicate where the word can be broken if necessary. This can help to ensure that the text remains readable on devices with smaller screens or narrower viewports.

Conclusion

The wbr tag is a useful tool for web developers who want to ensure that their text remains readable on devices with smaller screens or narrower viewports. By indicating where it is acceptable to break a word, the wbr tag can help to prevent text from overflowing its container and becoming difficult to read.

References

Activity