Open main menu

Changes

→‎top: shall we avoid W3Fools?
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->

''Wbr'' indicates a ''word break'' opportunity. This template includes the HTML tag [//www.w3.org/TR/html5/text-level-semantics.html#the-wbr-element &#60;wbr /&#62;], which is used to tell the browser of an optional, non-hyphenated line-break. It can be used with:
* {{tlx|nbsp}} or the equivalent <code>&amp;nbsp;</code> (non-breaking space)
* {{tlx|nowrap}} or the equivalent <code><nowiki><span style="white-space: nowrap;">...</span></nowiki></code> or <code><nowiki><span class="nowrap">...</span></nowiki></code> (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 [[WP:SUBST|substituted]], though there is no particular reason to do so.

==Usage==
Use is simple; there are no parameters:
* {{tlx|wbr}}
or
* {{tlxs|wbr}}

===Controlling line-breaking in infoboxes ===<!--This section name is linked to from other template documentation.-->
This template can be used to cause an indentation after a linebreak, in [[Template:Plainlist|unbulleted lists]] inside [[WP:Infobox|infoboxes]] and in [[WP:Table|tables]] with constrained cell widths, by using <code><nowiki>{{wbr}}&amp;nbsp;</nowiki></code> 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):
{{Infobox film|
|name=Test Infobox II: The Revenge
|...
|starring={{Plainlist|
* Jane Smith
* {{nobr|Johannes-Friedrich}}{{wbr}}&nbsp;Zauberzunge{{wbr}}&nbsp;{{nobr|von der Hasenpfeffer}}
* John Garcia
}}
|...
|italic title=no
}}
<source lang="html+handlebars">{{Infobox film|
|name=Test Infobox II: The Revenge
|...
|starring={{Plainlist|
* Jane Smith
* {{nobr|Johannes-Friedrich}}{{wbr}}&nbsp;Zauberzunge{{wbr}}&nbsp;{{nobr|von der Hasenpfeffer}}
* John Garcia
}}
|...
}}</source>

==Technical details==
This template encapsulates the code <code><nowiki><wbr />&#8203;</nowiki></code>, i.e. the HTML5 [[HTML element#wbr|line break opportunity element]] followed by the HTML character entity for the {{Unichar|200B|ZERO WIDTH SPACE}} character. This approach is superior to using either one or the other in isolation, for increased browser support. The {{tag|wbr|s}} element is compatible with all browsers except [[Internet Explorer]] inclusive of and {{em|since}} version 7 ({{as of|lc=y|2015|09}}). Meanwhile, the ZWS character is compatible with all browsers except Internet Explorer {{em|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.

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Line-handling templates]]
[[Category:Inline spacing templates]]
[[Category:Character templates]]
}}</includeonly>
Anonymous user