Difference between revisions of "Template:Font/doc"
(Created page with "<includeonly><!-- 在这里加入模板的保护标识 --></includeonly> <!-- 在本行下编辑模板说明 --> {{NeedsTranslating}} == 模板介绍 == '''<nowiki>{{Font}}</n...") |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly | + | <includeonly></includeonly> |
− | |||
− | |||
− | |||
− | |||
− | == | + | == Introduction == |
− | + | '''<nowiki>{{Font}}</nowiki>''' is based on CSS, and is used to define text styles like font, size, color, shadow and background color. | |
+ | |||
+ | == Structure == | ||
+ | There are 8 parameters of this template: | ||
{| class="wikitable" width="100%" | {| class="wikitable" width="100%" | ||
− | ! | + | !Parameter!!Introduction!!Type!!Default |
|- | |- | ||
|'''class''' | |'''class''' | ||
− | | | + | |The "class" attribute of the target text. |
− | | | + | |See also [[MediaWiki:Common.css]] |
− | |'' | + | |''N/A'' |
|- | |- | ||
|'''title''' | |'''title''' | ||
− | | | + | |Text comment. A "pop-up prompt box" will be displayed when hovering over the text. |
− | | | + | |Any character, except the pipe character('''<nowiki>|</nowiki>'''), two consecutive curly braces(<nowiki>{{</nowiki> or <nowiki>}}</nowiki>). The pipe character can be replaced by <code><nowiki>{{!}}</nowiki></code>. |
− | |'' | + | |''N/A'' |
|- | |- | ||
|'''font''' | |'''font''' | ||
− | | | + | |The font(s) of the target text. |
− | | | + | |The name of font(s), Multiple fonts should be separated by half-width comma(s)(''','''); About the possible value, please see [[enwp:List_of_typefaces_included_with_Microsoft_Windows|List of typefaces included with Microsoft Windows]] and [[enwp:List_of_typefaces_included_with_macOS|List of typefaces included with macOS]]. |
− | | | + | |See also [[MediaWiki:Common.css]] |
|- | |- | ||
|'''size''' | |'''size''' | ||
− | | | + | |The size of the target text. |
− | | | + | |A number; A unit such as px/em/ch/pt/% must be attached after the number, or you can use [https://developer.mozilla.org/en-US/docs/Web/CSS/calc calc()], otherwise default unit is px. |
|14px | |14px | ||
|- | |- | ||
|'''color''' | |'''color''' | ||
− | | | + | |The color of the target text. |
− | | | + | |Color code; When using hexadecimal codes, please use a half-width pound sign('''#''') as prefix, like '''#000000'''. See also [[Help:List of colors]]. |
|black | |black | ||
|- | |- | ||
|'''bgcolor''' | |'''bgcolor''' | ||
− | | | + | |The background color of the target text. |
− | | | + | |Color code; Same as the above. |
− | | | + | |Transparent(i.e. No background) |
|- | |- | ||
|'''shadowcolor''' | |'''shadowcolor''' | ||
− | | | + | |The shadow color of the target text. |
− | | | + | |Color code; Same as the above. |
− | | | + | |No shadow |
|- | |- | ||
|'''css''' | |'''css''' | ||
− | | | + | |Other CSS style for the target text. |
− | | | + | |Possible values are here→<ref>[https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts CSS Fonts]</ref>. |
− | |'' | + | |''N/A'' |
|- | |- | ||
|'''1''' | |'''1''' | ||
− | | | + | |The content of the target text. The first parameter that you don't give a name(i.e. <code><nowiki>{{font|name=VALUE}}</nowiki></code>) will be identified as the parameter '''1'''. |
− | | | + | |Any character, except the pipe character('''<nowiki>|</nowiki>'''), two consecutive curly braces(<nowiki>{{</nowiki> or <nowiki>}}</nowiki>). The pipe character can be replaced by <code><nowiki>{{!}}</nowiki></code>. |
− | |'' | + | |''N/A''; '''This is a required parameter.''' |
|} | |} | ||
− | == | + | == Use == |
− | #<code><nowiki>{{Font|class= | + | #<code><nowiki>{{Font|class=CLASS|title=TITLE|font=FONT|size=SIZE|color=COLOR|bgcolor=BACKGROUND COLOR|shadowcolor=SHADOW COLOR|css=CSS|TEXT}}</nowiki></code> |
− | #<code><nowiki>{{Font|class= | + | #<code><nowiki>{{Font|class=CLASS|title=TITLE|font=FONT|size=SIZE|color=COLOR|bgcolor=BACKGROUND COLOR|shadowcolor=SHADOW COLOR|css=CSS|1=TEXT}}</nowiki></code> |
− | + | Note: | |
− | * | + | * Except for parameter 1, other parameters are optional parameters. If omitted, the default value described in "Structure" will be used. |
− | * | + | * Changing the order of the parameters will not affect the use. |
− | * | + | * If there is a half-width equal sign('''=''') in the text, you must take the second usage, otherwise the text will not be displayed. |
− | == | + | == Examples == |
− | + | For example, the outcome of <code><nowiki>{{Font|color=#7f5620|font=Times New Roman|size=20px|Text is here.}}</nowiki></code> | |
− | + | is: {{Font|color=#7f5620|font=Times New Roman|size=20px|Text is here.}} | |
{| class="wikitable" width="100%" | {| class="wikitable" width="100%" | ||
− | ! | + | ! Input !! Outcome |
|- | |- | ||
− | |<code><nowiki>{{Font| | + | |<code><nowiki>{{Font|Plain text}}</nowiki></code> |
− | |{{Font| | + | |{{Font|Plain text}} |
|- | |- | ||
|<code><nowiki>{{Font|color=#7f5620|font=楷体|size=20px|啡色的文字。}}</nowiki></code> | |<code><nowiki>{{Font|color=#7f5620|font=楷体|size=20px|啡色的文字。}}</nowiki></code> | ||
Line 91: | Line 90: | ||
|{{Font|size=25px|也可以只选用其中一项选项。}} | |{{Font|size=25px|也可以只选用其中一项选项。}} | ||
|- | |- | ||
− | |<code><nowiki>{{Font|color=#FF0000|1= | + | |<code><nowiki>{{Font|color=#FF0000|1=If there is a equal sign(=), then add "1=" at the beginning of the text.}}</nowiki></code> |
− | |{{Font|color=#FF0000|1= | + | |{{Font|color=#FF0000|1=If there is a equal sign(=), then add "1=" at the beginning of the text.}} |
|} | |} | ||
== References == | == References == | ||
<references /> | <references /> | ||
+ | <noinclude> | ||
+ | {{Formatting templates}} | ||
+ | </noinclude> | ||
<includeonly> | <includeonly> | ||
− | + | [[Category:Formatting templates]] | |
− | [[Category: | ||
</includeonly> | </includeonly> |
Latest revision as of 21:18, 22 March 2023
Contents
Introduction
{{Font}} is based on CSS, and is used to define text styles like font, size, color, shadow and background color.
Structure
There are 8 parameters of this template:
Parameter | Introduction | Type | Default |
---|---|---|---|
class | The "class" attribute of the target text. | See also MediaWiki:Common.css | N/A |
title | Text comment. A "pop-up prompt box" will be displayed when hovering over the text. | Any character, except the pipe character(|), two consecutive curly braces({{ or }}). The pipe character can be replaced by {{!}} .
|
N/A |
font | The font(s) of the target text. | The name of font(s), Multiple fonts should be separated by half-width comma(s)(,); About the possible value, please see List of typefaces included with Microsoft Windows and List of typefaces included with macOS. | See also MediaWiki:Common.css |
size | The size of the target text. | A number; A unit such as px/em/ch/pt/% must be attached after the number, or you can use calc(), otherwise default unit is px. | 14px |
color | The color of the target text. | Color code; When using hexadecimal codes, please use a half-width pound sign(#) as prefix, like #000000. See also Help:List of colors. | black |
bgcolor | The background color of the target text. | Color code; Same as the above. | Transparent(i.e. No background) |
shadowcolor | The shadow color of the target text. | Color code; Same as the above. | No shadow |
css | Other CSS style for the target text. | Possible values are here→[1]. | N/A |
1 | The content of the target text. The first parameter that you don't give a name(i.e. {{font|name=VALUE}} ) will be identified as the parameter 1.
|
Any character, except the pipe character(|), two consecutive curly braces({{ or }}). The pipe character can be replaced by {{!}} .
|
N/A; This is a required parameter. |
Use
{{Font|class=CLASS|title=TITLE|font=FONT|size=SIZE|color=COLOR|bgcolor=BACKGROUND COLOR|shadowcolor=SHADOW COLOR|css=CSS|TEXT}}
{{Font|class=CLASS|title=TITLE|font=FONT|size=SIZE|color=COLOR|bgcolor=BACKGROUND COLOR|shadowcolor=SHADOW COLOR|css=CSS|1=TEXT}}
Note:
- Except for parameter 1, other parameters are optional parameters. If omitted, the default value described in "Structure" will be used.
- Changing the order of the parameters will not affect the use.
- If there is a half-width equal sign(=) in the text, you must take the second usage, otherwise the text will not be displayed.
Examples
For example, the outcome of {{Font|color=#7f5620|font=Times New Roman|size=20px|Text is here.}}
is: Text is here.
Input | Outcome |
---|---|
{{Font|Plain text}}
|
Plain text |
{{Font|color=#7f5620|font=楷体|size=20px|啡色的文字。}}
|
啡色的文字。 |
{{Font|color=#bf00bf|font=Century Gothic|size=35px|Hello World!}}
|
Hello World! |
{{Font|bgcolor=#364d6a|color=#c9b295|font=Simhei|size=16px|囧囧囧囧囧}}
|
囧囧囧囧囧 |
{{Font|title=就像这样|bgcolor=#f9f9ef|color=#5a7aad|shadowcolor=blue|font=Simhei|size=24px|可以选用全部选项。}}
|
可以选用全部选项。 |
{{Font|size=25px|可以只选用其中一项选项。}}
|
也可以只选用其中一项选项。 |
{{Font|color=#FF0000|1=If there is a equal sign(=), then add "1=" at the beginning of the text.}}
|
If there is a equal sign(=), then add "1=" at the beginning of the text. |
References
|