The <wbr> tag in HTML is used to create a Word Break opportunity. It offers a very fine level of control over where long “words” can break. I came across this tag in a post when I was busy researching how best to deal with long URLs in Word Documents and HTML pages. The <wbr> tag is in a way the opposite of HTML’s non-breaking space, &nbsp;

In this post:
  1. Where
  2. How
Required knowledge:

1. Where

Let us start with some rules around where URLs can be “broken up” between lines:

To achieve the equivalent in a Word document, see Splitting URLs over multiple lines.

  • After a : (colon) or a // (double forward-slash)
  • Before a / (single slash), a ~ (tilde), a . (full stop), a , (comma), a - (hyphen), an _ (underscore), a ? (question mark), a number sign, or a % (percent symbol)
  • Before or after an = (equals sign) or an & (ampersand)

2. How

Compare the first paragraph to the paragraph that follows as you resize your browser horizontally:

Link to more information: https://www.businesswritingblog.com/business_writing/2006/06/how_to_urls_and.html

Vs.

Link to more information: https://www.businesswritingblog.com/business_writing/2006/06/how_to_urls_and.html

Note that the above is achieved without adding any punctuation that could be confused as part of the URL itself, for example, a hyphen.

See also the following HTML entities:

  • &#8203; which is for a Unicode character called the zero-width space (ZWSP).
  • the soft hyphen which is &shy;

References:

  1. HTML <wbr> Tag. (2022). Retrieved 17 October 2022, from https://www.w3schools.com/tags/tag_wbr.asp
  2. Using the shy soft hyphen in HTML | Tutorial. [online]. Available at: https://daily-dev-tips.com/posts/using-the-shy-soft-hyphen-in-html/

By MisterFoxOnline

Mister Fox AKA @MisterFoxOnline is an ICT, IT and CAT Teacher. He has a passion for technology and loves to find solutions to problems using the skills he has learned in the course of his IT career.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from stylus

Subscribe now to keep reading and get access to the full archive.

Continue reading