跳转到内容

模板:键盘按钮/doc

本页使用了标题或全文手工转换
维基百科,自由的百科全书

本模板{{key press}}旨在文章内插入如同电脑键盘按键及组合的显示样式。

例如

{{键盘按钮|A}}A

因为大部分键盘上的英文字母并不是小写的a到z,故请改成大写的。

键盘按钮组合

要组合显示按键,可以这样输入:

{{键盘按钮|Alt|P}}Alt+P
{{键盘按钮|Ctrl|Alt|Del}}Ctrl+Alt+Del

当本模板的参数超过2个的时候,按键之间会使用两侧没有空白的“+”、或是手动设置的chain参数夹着。 不过因为串接符号之间没有空格,会导致整串按键组合不会自动换行。为了避免按键组合过长,导致像是在表格中过宽的问题,你可以重复调用本模板,并手动增加两侧有空白的“+”:

{{键盘按钮|Ctrl}} + {{键盘按钮|Alt}} + {{键盘按钮|Del}}Ctrl + Alt + Del

或是调整chain参数成:

{{键盘按钮|Ctrl|Alt|Del|chain= + }}Ctrl + Alt + Del

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing 0177 (with the numeric keypad). This could be illustrated like this:

{{键盘按钮|Alt|0}}{{键盘按钮|1}}{{键盘按钮|7}}{{键盘按钮|7}} produces Alt+0177

维基链接

你可以在有关键盘的条目内使用此模板,例如:

  • {{键盘按钮|[[Alt]]}} 产生 Alt

当你在使用此模板时,请确保你链接到了正确的页面(例如:使用[[Control key|Ctrl]]而不是[[Ctrl]],这会链接到一个消歧义页面。)

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the {{!}}, {{;}} and {{=}} templates:

  • {{键盘按钮|{{!}}}} produces |
  • {{键盘按钮|{{;}}}} produces ;
  • {{键盘按钮|{{=}}}} produces =

However, if the characters are marked as wikilinks, they can be entered as such:

  • {{键盘按钮|[[|]]}} produces |
  • {{键盘按钮|[[;]]}} produces ;
  • {{键盘按钮|[[=]]}} produces =

If you don't want to mark the characters as links, {{键盘按钮|<nowiki>|</nowiki>}} is also an option.

键盘符号

某些按键名有其对应的Unicode字符。本模板会自动向下列按键名后加入对应“符号”:

  • {{键盘按钮|Shift}} 产生 ⇧ Shift
  • {{键盘按钮|Caps Lock}} 产生 ⇪ Caps Lock
  • {{键盘按钮|Enter}} 产生 ↵ Enter
  • {{键盘按钮|Tab}} 产生 Tab ↹
  • {{键盘按钮|Backspace}} 产生 ← Backspace
  • {{键盘按钮|Command}} 产生 ⌘ Command
  • {{键盘按钮|Cmd}} 产生 ⌘ Cmd
  • {{键盘按钮|Option}} 产生 ⌥ Option
  • {{键盘按钮|Opt}} 产生 ⌥ Opt
  • {{键盘按钮|Up}} 产生
  • {{键盘按钮|Down}} 产生
  • {{键盘按钮|Left}} 产生
  • {{键盘按钮|Right}} 产生
“Windows”徽标键与菜单键
老式“Windows”徽标键

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • {{键盘按钮|Win}} produces ⊞ Win
  • {{键盘按钮|Menu}} produces ≣ Menu

电子游戏

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • {{键盘按钮|l-down}} produces L↓
  • {{键盘按钮|c-left}} produces C←
  • {{键盘按钮|r-up}} produces R↑

Stick specific diagonals are also supported:

  • {{键盘按钮|l-nw}} produces L↖
  • {{键盘按钮|c-se}} produces C↘
  • {{键盘按钮|r-ne}} produces R↗
PlayStation
  • {{键盘按钮|ex}} produces ×
  • {{键盘按钮|circle}} produces
  • {{键盘按钮|triangle}} produces
  • {{键盘按钮|square}} produces

模板参数

Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.

模板参数

参数描述类型状态
第一个按键1

第一个按键

单行文本必需
第二个按键2

按键组合中的第二个按键(可选)

单行文本可选
第三个按键3

按键组合中的第三个按键(可选)

单行文本可选
第四个按键4

按键组合中的第四个按键(可选)

单行文本可选
第五个按键5

按键组合中的第五个按键(可选)

单行文本可选
第六个按键6

按键组合中的第六个按键(可选)

单行文本可选
第七个按键7

按键组合中的第七个按键(可选)

单行文本可选
第八个按键8

按键组合中的第八个按键(可选)

单行文本可选
第九个按键9

按键组合中的第九个按键(可选)

单行文本可选
第十个按键10

按键组合中的第十个按键(可选)

单行文本可选
串接符号chain

按键组合中串接各个按键使用的符号

默认值
+
单行文本可选
串接符号#1chain first

按键组合中串接第一和第二按键使用的符号

默认值
+
单行文本可选
串接符号#2chain second

按键组合中串接第二和第三按键使用的符号

默认值
+
单行文本可选
串接符号#3chain third

按键组合中串接第三和第四按键使用的符号

默认值
+
单行文本可选
串接符号#4chain fourth

按键组合中串接第四和第五按键使用的符号

默认值
+
单行文本可选

参见

  • {{Key top}} – 产生类似视觉效果,但包含更多的符号,但不能直接支持组合 (e.g. ⇬ Caps Lock)
  • {{Button}} – 产生类似视觉效果,但没有语义标记 (e.g. sample text); 更多用于表示界面元素。
  • {{Kbd}} – to indicate user input (of any kind) without making it look like keys or buttons

Template:Semantic markup templates