<WBR>: A Useful, but Little-Known, HTML Tag

Mar 25, 2010
Mar252010

<WBR>: A Useful, but Little-Known, HTML Tag

A little-known HTML tag can save a lot of headache when it comes to displaying file-paths, lines of code, or other long lines of text: .

As I was working on my last post, I was running into a problem with the word wrap:

The problem was stemming from this line:

[html]/vender/extensions/{extension}/config/spree_permissions.yml[/html]

To fix this, it was a matter of inserting the tag into a few spots:

[html]/vender/extensions/{extension}/config/spree_permissions.yml[/html]

After that, the word wrap was fixed:

What does the tag actually do? Basically, it lets the browser know that a line break can be inserted there if needed. In my example, I put the tag in two spots, but the browser only used one of them. This is very useful for long lines of code, where punctuation is part of the word and no spaces are used to break up the text. It is also very useful for file paths, as in my example.