• Home
  • Random
  • Log in
  • Settings
  • About English Wikipedia @ Freddythechick
English Wikipedia @ Freddythechick

Template:Wbr/sandbox

  • Language
  • Watch
  • View source
< Template:Wbr

​

__EXPECTUNUSEDTEMPLATE__This is the template sandbox page for Template:Wbr (diff).
See also the companion subpage for test cases.
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.

Wbr indicates a word break opportunity. This template includes the HTML tag <wbr />, which is used to tell the browser of an optional, non-hyphenated line-break. It can be used with:

  • {{nbsp}} or the equivalent &nbsp; (non-breaking space)
  • {{nowrap}} or the equivalent <span style="white-space: nowrap;">...</span> or <span class="nowrap">...</span> (character string that will not break even at a normal space)

to carefully control line-breaking where this is important.

This template can safely be substituted, though there is no particular reason to do so. For breaking up long words, use {{Soft hyphen}} instead.

Contents

  • 1 Usage
    • 1.1 Controlling line-breaking in infoboxes
    • 1.2 Breaking up slashes
  • 2 Technical details

Usage

Use is simple; there are no parameters:

  • {{wbr}}

or

  • {{subst:wbr}}

Controlling line-breaking in infoboxes

This template can be used to cause an indentation after a linebreak, in unbulleted lists inside infoboxes and in tables with constrained cell widths, by using {{wbr}}&nbsp; between words in an entry, so that when they wrap they are not mistaken for separate entries. See example infobox to the side.

Example infobox (rendered to the side of the example code):

Test Infobox II: The Revenge
Starring
  • Jane Smith
  • Johannes-Friedrich​ Zauberzunge​ von der Hasenpfeffer
  • John Garcia
<syntaxhighlight lang="wikitext">
Test Infobox II: The Revenge
Starring
  • Jane Smith
  • Johannes-Friedrich​ Zauberzunge​ von der Hasenpfeffer
  • John Garcia
</syntaxhighlight>

Breaking up slashes

Further information: MOS:SLASH

When there are long words on both sides of a slash, this template may be used to induce a line break after the slash.

installation/​execution
<syntaxhighlight lang="wikitext" inline=yes>installation/​execution</syntaxhighlight>

Technical details

This template encapsulates the code <wbr />&#8203;, i.e. the HTML5 line break opportunity element followed by the HTML character entity for the U+200B ZERO WIDTH SPACE character. This approach is superior to using either one or the other in isolation, for increased browser support. The <wbr /> element is compatible with all browsers except Internet Explorer inclusive of and since version 7 (as of September 2015[update]). Meanwhile, the ZWS character is compatible with all browsers except Internet Explorer earlier than (but not inclusive of) version 7. Thus, between the two approaches, the dual use of which has no ill effects, this template works in all browsers still likely to be in use, including Internet Explorer regardless of version.

The above documentation is transcluded from Template:Wbr/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://enwiki.freddythechick.net/index.php?title=Template:Wbr/sandbox&oldid=8423476"
Last edited on 14 October 2022, at 23:26

Languages

      This page is not available in other languages.

      English Wikipedia @ Freddythechick
      • This page was last edited on 14 October 2022, at 23:26.
      • Content is available under Creative Commons Attribution-ShareAlike 4.0 unless otherwise noted.
      • About English Wikipedia @ Freddythechick
      • Desktop