查看“︁模板:Nowrap/doc”︁的源代码
来自康健生活
←
模板:Nowrap/doc
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> {{tlx|Nowrap}} or {{tlx|nowrap}} stops wrapping of specific text. It prevents word wraps (line breaks) within text or inside a link which contains spaces, hyphens ("-"), or, in some browsers, parentheses. The size of the nowrapped text becomes the minimum width of that paragraph and that can negatively influence the ability of the page to adapt to smaller screens, or alternate representations of the content. == Usage == :: <code><nowiki>{{Nowrap|these words stay together}}</nowiki></code> :: <code><nowiki>{{Nowrap|a, b, c, or d.}}</nowiki></code> :: <code><nowiki>{{Nowrap| merry-go-round }}</nowiki></code> :: <code><nowiki>{{Nowrap| [[4-part harmony]] }}</nowiki></code> :: <code><nowiki>{{Nowrap| [[Cascading Style Sheets|CSS]] }}</nowiki></code> :: <code><nowiki>{{Nowrap| [[#Examples|Examples section]] }}</nowiki></code> === Examples === {| class=wikitable |"<code>They held <nowiki>{{Nowrap|10 kg (22 lb)}}</nowiki> in total.</code>" <br/> May render like this: :They held {{Nowrap|10 kg (22 lb)}} <br/>in total. <br/> Or like this: :They held <br/>10 kg (22 lb) in total. <br/> But ''not'' render like this: :They held 10 kg (22 <br/>lb) in total. | "<code>He encountered <nowiki>{{Nowrap|a tiger}}</nowiki> in the woods.</code>" <br/> May render like this: :He encountered a tiger <br/>in the woods. <br/> Or like this: :He encountered <br/>a tiger in the woods. <br/> But ''not'' like this: :He encountered a <br/>tiger in the woods. |} === Handling equal-sign or bar === [[Help:Templates|Templates]] have problems with parameter data that contains equal-signs "<code>=</code>" or vertical bars "<code>|</code>" (pipes). Note that this does not apply if the equal-sign "<code>=</code>" or vertical bar "<code>|</code>" is inside a wikilink or another template. However, there are workarounds: For text that includes an equal-sign "=", precede the text with <code>1=</code>, use a triple-brace unnamed parameter <code><nowiki>{{{|=}}}</nowiki></code>, or the <code><nowiki>{{=}}</nowiki></code> template. For example: :<code><nowiki>{{Nowrap|</nowiki>1=2 + 2 = 4}}</code>, <br /><code><nowiki>{{Nowrap|2 + 2 {{{|=}}} 4}}</nowiki></code>, or <br /><code><nowiki>{{Nowrap|2 + 2 {{=}} 4}}</nowiki></code> which all render as this: :{{Nowrap|1=2 + 2 = 4}}. For text that includes a vertical bar "|", escape the bar(s) with "<code><nowiki>&#124;</nowiki></code>" or "<code><nowiki>{{!}}</nowiki></code>". For instance, put two bars "|6|" like this: :<code><nowiki>{{Nowrap|</nowiki>&#124;6&#124; < 7}}</code> or <code><nowiki>{{Nowrap|{{!}}6{{!}} < 7}}</nowiki></code> Which renders this: :{{Nowrap||6| < 7}} == Technical details == The actual code that does the job is this HTML {{tag|span|open|link=yes}} tag that applies a class to the text inside the template: <syntaxhighlight lang="html"> <span class="nowrap">This text will not wrap</span> </syntaxhighlight> The class <code>nowrap</code> receives the CSS property <syntaxhighlight lang="css" inline>white-space: nowrap;</syntaxhighlight> in {{Blue|MediaWiki:Common.css}}. == TemplateData == <templatedata> { "description": { "en": "Prevents word wraps (line breaks) within text or inside a link which contains spaces or hyphens (-).", "cs": "Zabraňuje zalamování slov (zalomení řádků) v textu nebo uvnitř odkazu, který obsahuje mezery nebo spojovníky (-).", "pt-br": "Evita quebras de linha no texto ou dentro de uma ligação que contenha espaços ou hífens (-)." }, "format": "inline", "params": { "1": { "label": { "en": "Text", "cs": "Text", "pt-br": "Texto" }, "description": { "en": "Text or link to be protected.", "cs": "Text nebo odkaz, který má být chráněn.", "pt-br": "Texto ou ligação a serem protegidos." }, "type": "string", "required": true } } } </templatedata> <includeonly>{{Sandbox other|| <!-- Categories below this line; interwikis at Wikidata --> [[Category:Formatting templates]] }}</includeonly>
此页面嵌入的页面:
模板:Nowrap
(
查看源代码
)
模板:Nowrap/styles.css
(
查看源代码
)
模板:Tlx
(
查看源代码
)
返回
模板:Nowrap/doc
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。