Difference between revisions of "Template:Font/doc"

From Moegirlpedia
Jump to: navigation, search
(Created page with "<includeonly><!-- 在这里加入模板的保护标识 --></includeonly> <!-- 在本行下编辑模板说明 --> {{NeedsTranslating}} == 模板介绍 == '''<nowiki>{{Font}}</n...")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><!-- 在这里加入模板的保护标识 --></includeonly>
+
<includeonly></includeonly>
<!-- 在本行下编辑模板说明 -->
 
{{NeedsTranslating}}
 
== 模板介绍 ==
 
'''<nowiki>{{Font}}</nowiki>'''模版基于CSS样式表,用来设定字体、大小、颜色、阴影及底色。
 
  
== 结构 ==
+
== Introduction ==
本模板有8个参数:
+
'''<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'''
| 目标文字的 class 属性。
+
|The "class" attribute of the target text.
|{{参见|[[MediaWiki:Common.css]]}}
+
|See also [[MediaWiki:Common.css]]
|''''
+
|''N/A''
 
|-
 
|-
 
|'''title'''
 
|'''title'''
| 文字的注释。鼠标悬停在文字上时会以“弹出式提示框”的形式显示。
+
|Text comment. A "pop-up prompt box" will be displayed when hovering over the text.
|任意字符,除管道符('''<nowiki>|</nowiki>''')、连续两个大括号(<nowiki>{{</nowiki><nowiki>}}</nowiki>)外。管道符可以用<code><nowiki>{{!}}</nowiki></code>代替。
+
|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.
|字体名称,多个字体应用半角逗号(''',''')隔开,具体用法参见→<ref>[http://www.w3school.com.cn/cssref/pr_font_font-family.asp CSS font-family 属性]</ref>;可能的值参见[[zhwiki:Microsoft_Windows字体列表|Windows字体列表]][[zhwiki:Mac_OS_X字体列表|Mac OS X字体列表]]
+
|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]].
|参见[[MediaWiki:Common.css]]
+
|See also [[MediaWiki:Common.css]]
 
|-
 
|-
 
|'''size'''
 
|'''size'''
| 目标文字缩放尺寸。
+
|The size of the target text.
|数字;使用时需附单位:px/em/ch/pt/%,或是使用[https://developer.mozilla.org/zh-CN/docs/Web/CSS/calc calc()],否则默认单位为px
+
|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.
|颜色代码;使用十六进制代码时应用半角井号('''#''')做前缀,如'''#000000'''。参见[[Help:颜色列表]]
+
|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'''
| 目标文字的其他CSS样式
+
|Other CSS style for the target text.
|可能的值参见→<ref>[https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts CSS Fonts]</ref>
+
|Possible values are here→<ref>[https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts CSS Fonts]</ref>.
|''''
+
|''N/A''
 
|-
 
|-
 
|'''1'''
 
|'''1'''
| 目标文字内容。如果在使用时没有为一个参数给定名称(即<code><nowiki>{{font|参数名=参数值}}</nowiki></code>),那么第一个这样的参数会被理解为参数'''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'''.
|任意字符,除管道符('''<nowiki>|</nowiki>''')、连续两个大括号(<nowiki>{{</nowiki><nowiki>}}</nowiki>)外。管道符可以以<code><nowiki>{{!}}</nowiki></code>代替。
+
|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=class属性|title=标题|font=文字字体|size=大小|color=颜色|bgcolor=背景颜色|shadowcolor=阴影颜色|css=其他css样式|文字}}</nowiki></code>
+
#<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=class属性|title=标题|font=文字字体|size=大小|color=颜色|bgcolor=背景颜色|shadowcolor=阴影颜色|css=其他css样式|1=文字}}</nowiki></code>
+
#<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:
*除参数1外其他参数均是可省略参数,若省略,则会使用“结构”中所述的默认值。
+
* 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 ==
比如,输入<code><nowiki>{{Font|color=#7f5620|font=楷体|size=20px|文字在这里。}}</nowiki></code>
+
For example, the outcome of <code><nowiki>{{Font|color=#7f5620|font=Times New Roman|size=20px|Text is here.}}</nowiki></code>
  
结果会是︰{{Font|color=#7f5620|font=楷体|size=20px|文字在这里。}}
+
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|不变化}}</nowiki></code>
+
|<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=如果有=出现,必须要指明参数为1,即在前面写上“1=”。}}</nowiki></code>
+
|<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=如果有=出现,必须要指明参数为1,即在前面写上“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:Functional Templates]]
 
 
</includeonly>
 
</includeonly>

Latest revision as of 21:18, 22 March 2023


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

  1. {{Font|class=CLASS|title=TITLE|font=FONT|size=SIZE|color=COLOR|bgcolor=BACKGROUND COLOR|shadowcolor=SHADOW COLOR|css=CSS|TEXT}}
  2. {{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