Difference between revisions of "Template:Key press"

From Zero-K
Jump to navigation Jump to search
(Uses sans-serif fonts for keys now (to see if it looks better than proportional).)
m
Line 3: Line 3:
 
==Usage==
 
==Usage==
 
<code><nowiki>{{</nowiki>Key press<nowiki>|key|border style}}</nowiki></code>
 
<code><nowiki>{{</nowiki>Key press<nowiki>|key|border style}}</nowiki></code>
* ''key'' is the literal name of the key to be pressed. For ''F4'', for example, the syntax is <code><nowiki>{{</nowiki>Key press<nowiki>|F4}}</nowiki></code>. This results in the following: {{Key press|F4}}
+
* <var>key</var> is the literal name of the key to be pressed. For ''F4'', for example, the syntax is <code><nowiki>{{</nowiki>Key press<nowiki>|F4}}</nowiki></code>. This results in the following: {{Key press|F4}}
 
* HTML character entities are allowed. For example, to display the multiplication symbol, this works: <code><nowiki>{{</nowiki>Key press|'''<nowiki>&amp;times;</nowiki>'''<nowiki>}}</nowiki></code> and results in {{Key press|&times;}}.
 
* HTML character entities are allowed. For example, to display the multiplication symbol, this works: <code><nowiki>{{</nowiki>Key press|'''<nowiki>&amp;times;</nowiki>'''<nowiki>}}</nowiki></code> and results in {{Key press|&times;}}.
* To display a pressed key, add ''inset'' border style like this: <code><nowiki>{{</nowiki>Key press<nowiki>|F4|inset}}</nowiki></code> and the key will appear to be pressed: {{Key press|F4|inset}}.
+
* To display a pressed key, add <code>inset</code> border style like this: <code><nowiki>{{</nowiki>Key press<nowiki>|F4|inset}}</nowiki></code> and the key will appear to be pressed: {{Key press|F4|inset}}.
* The ''key'' and ''border'' parameters can be reversed, but then their names need to be specified: <code><nowiki>{{</nowiki>Key press<nowiki>|border=inset|key=F4}}</nowiki></code> will become {{Key press|border=inset|key=F4}}
+
* The <var>key</var> and <var>border</var> parameters can be reversed, but then their names need to be specified: <code><nowiki>{{</nowiki>Key press<nowiki>|border=inset|key=F4}}</nowiki></code> will become {{Key press|border=inset|key=F4}}
 
* Forgetting to specify a key will default to the equals sign: <code><nowiki>{{</nowiki>Key press<nowiki>}}</nowiki></code> becomes {{Key press }}.
 
* Forgetting to specify a key will default to the equals sign: <code><nowiki>{{</nowiki>Key press<nowiki>}}</nowiki></code> becomes {{Key press }}.
 
</noinclude>
 
</noinclude>

Revision as of 16:09, 13 June 2020

A simple template that makes it easier to see that a keyboard key is involved.

Usage

{{Key press|key|border style}}

  • key is the literal name of the key to be pressed. For F4, for example, the syntax is {{Key press|F4}}. This results in the following: F4
  • HTML character entities are allowed. For example, to display the multiplication symbol, this works: {{Key press|&times;}} and results in ×.
  • To display a pressed key, add inset border style like this: {{Key press|F4|inset}} and the key will appear to be pressed: F4.
  • The key and border parameters can be reversed, but then their names need to be specified: {{Key press|border=inset|key=F4}} will become F4
  • Forgetting to specify a key will default to the equals sign: {{Key press}} becomes =.