今天是2024年十一月23日 第47周 星期六
代人,时大变了。
我们生活在大地上,但我们的梦想超越天空。
“Template:Userbox/doc”的版本间的差异
(清空全部内容) 标签:清空 |
小 (已还原Uuuuuuuuuuuuuuuuueuuuuuuueuuu(对话)的编辑至最后由白龙修订的版本) 标签:回退 |
||
第1行: | 第1行: | ||
+ | {{NoteTA | ||
+ | |G1 = IT | ||
+ | |G2 = MediaWiki | ||
+ | }} | ||
+ | {{Documentation subpage}} | ||
+ | {{Lua|Module:Userbox}} | ||
+ | {{High-use|24518}} | ||
+ | <!-- 在本行下編輯模板說明 --> | ||
+ | == 模板介紹 == | ||
+ | 本模板適用於建置[[wikipedia:用戶框|用戶框]],提供使用者在用戶頁面顯示使用者的一些資訊,以免於HTML與Wikitable參數的麻煩。 | ||
+ | |||
+ | '''[[WP:NFCC|合理使用圖像]]不得用於用戶框,任何使用者可在不經對方同意下,移除相關圖片。''' | ||
+ | |||
+ | == 使用方式 == | ||
+ | <pre style="overflow: auto">-{}- | ||
+ | {{Userbox | ||
+ | |bodyclass = <!--自訂HTML Class參數--> | ||
+ | |border-c = <!--邊框色彩 (預設與 id-c 之參數相同)--> | ||
+ | |border-s = <!--邊框像素大小 (預設值:1)--> | ||
+ | |float = <!--流動對齊方式 left|right|none (預設值:left)--> | ||
+ | |id = <!--id 圖片或文字(選用,預設尺寸是x45px)--> | ||
+ | |id-a = <!--id 水平對齊方式 left/center/right/justify (預設:center)--> | ||
+ | |id-c = <!--id 的背景色彩 (預設:#d0d0d0)--> | ||
+ | |id-fc = <!--id 的文字色彩 (預設:black)--> | ||
+ | |id-h = <!--id 框的像素大小 (預設:45)--> | ||
+ | |id-lh = <!--id 行高 (預設:1em)--> | ||
+ | |id-op = <!--id 的其他 CSS 參數--> | ||
+ | |id-p = <!--id 的儲存格留白值 (預設:0 1px 0 0)--> | ||
+ | |id-s = <!--id 文字點數 (預設:14)--> | ||
+ | |id-w = <!--id 框長度 (預設:45)--> | ||
+ | |info-class = <!--Adds an HTML class attribute to the "info" HTML table-row, to allow for styling, emission of microformats, etc.--> | ||
+ | |info = <!--info 框圖文內容--> | ||
+ | |info-a = <!--info 框水平對齊方式 left/center/right/justify (預設:left)--> | ||
+ | |info-c = <!--info 框背景色 (預設:#e0e0e0)--> | ||
+ | |info-fc = <!--info 框文字色彩 (預設:black)--> | ||
+ | |info-lh = <!--info 框行高 (預設:1.25em)--> | ||
+ | |info-op = <!--info 框的其他CSS樣式參數--> | ||
+ | |info-p = <!--info 框的留白值 (預設:0 4px 0 4px)--> | ||
+ | |info-s = <!--info 文字點數 (預設:8)--> | ||
+ | |nocat = <!--屏蔽頁面分類 (預設:false)--> | ||
+ | |usercategory = <!--使用者自設分類(選用)--> | ||
+ | |usercategory2 = <!--使用者自設分類(選用)--> | ||
+ | |usercategory3 = <!--使用者自設分類(選用)--> | ||
+ | }} | ||
+ | </pre> | ||
+ | * 全部參數皆為選填 | ||
+ | * 圖像建議少於45px | ||
+ | <!-- explain what this template's parameters do -- if no params, delete the definition --> | ||
+ | |||
+ | 多数基于HTML的表格仅用这些参数的一小部分。以下子集可以用来把HTML用户框快速转换成这里所用的格式: | ||
+ | |||
+ | <pre> | ||
+ | {{Userbox | ||
+ | |border-c = | ||
+ | |id = | ||
+ | |id-c = | ||
+ | |id-fc = | ||
+ | |id-s = | ||
+ | |info = | ||
+ | |info-c = | ||
+ | |info-fc = | ||
+ | |info-lh = | ||
+ | |info-s = | ||
+ | |nocat = {{{nocat|}}} | ||
+ | |usercategory = | ||
+ | }} | ||
+ | </pre> | ||
+ | |||
+ | == 範例 == | ||
+ | {| | ||
+ | !style="width: 300px;"| 代码 | ||
+ | !效果 | ||
+ | |- | ||
+ | | <pre>{{Userbox}}</pre> || {{Userbox}} | ||
+ | |- | ||
+ | | <pre>{{Userbox | ||
+ | |border-c = #aaffaa | ||
+ | |border-s = 2 | ||
+ | |id = foo | ||
+ | |id-c = #ffffee | ||
+ | |id-s = 20 | ||
+ | |info = ''foo bar'' | ||
+ | |info-c = #ffeeff | ||
+ | |info-s = 12 | ||
+ | }}</pre> || {{Userbox|id=foo|id-s=20|id-c=#ffffee|info=''foo bar''|info-c=#ffeeff|info-s=12|border-c=#aaffaa|border-s=2}} | ||
+ | |- | ||
+ | | colspan="2"| 以下展示高度超过45px的用户框的默认外观,比较一下上下两个用户框的差异。 | ||
+ | |- | ||
+ | | <pre>{{Userbox | ||
+ | |border-c = #aaffaa | ||
+ | |border-s = 2 | ||
+ | |id = foo logo | ||
+ | |id-c = #ffffee | ||
+ | |info = ''We are trying to see | ||
+ | default distance in between text | ||
+ | lines, see the distance in | ||
+ | between cell content and its border, | ||
+ | and also see total height.'' | ||
+ | |info-c = #ffeeff | ||
+ | }}</pre> || {{Userbox|id=foo logo|id-c=#ffffee|info=''We are trying to see default distance in between text lines, see the distance in between cell content and its border, and also see total height.''|info-c=#ffeeff|border-c=#aaffaa|border-s=2}} | ||
+ | |- | ||
+ | | colspan="2"| 以下展示怎样能修改用户框并进一步指定参数来降低用户框的高度以达到推荐的45px,即使有四行文字。在四行文字之下,单元格边距参数info-p也可以设置成1pt 1pt 1pt 2pt,或者1pt 2pt以达到更好的效果。 | ||
+ | |- | ||
+ | | <pre>{{Userbox | ||
+ | |border-c = #aaffaa | ||
+ | |border-s = 1 | ||
+ | |id = foo logo | ||
+ | |id-c = #ffffee | ||
+ | |id-lh = 1.1em | ||
+ | |id-s = 14 | ||
+ | |info = ''We have specified values | ||
+ | to lessen the distance in between | ||
+ | text lines & padding space in between | ||
+ | cell content and its border.'' | ||
+ | |info-c = #ffeeff | ||
+ | |info-lh = 1.05em | ||
+ | |info-p = 1pt | ||
+ | |info-s = 8 | ||
+ | }}</pre> || {{Userbox|id=foo logo|id-s=14|id-lh=1.1em|id-c=#ffffee|info=''We have specified values to lessen the distance in between text lines & padding space in between cell content and its border.''|info-c=#ffeeff|info-s=8|info-p=1pt|info-lh=1.05em|border-c=#aaffaa|border-s=1}} | ||
+ | |- | ||
+ | | colspan="2"| 以下针对高级用户,展示怎样指定其他[[CSS]]属性,例如,font-family调整字体,text-align从默认参数调整对齐方式。如下所示,右边是2个用户框:上面一个是不带font-family或text-align参数;下面一个是以填写info-op参数来使用此类代码显示的。 | ||
+ | |- | ||
+ | | <pre>{{Userbox | ||
+ | |border-c = #afa | ||
+ | |border-s = 2 | ||
+ | |id = foo logo | ||
+ | |id-c = #ffe | ||
+ | |id-lh = 1.1em | ||
+ | |id-s = 14 | ||
+ | |info = foo bar | ||
+ | |info-c = #fef | ||
+ | |info-op = font-family:'Courier New'; text-align:center; | ||
+ | |info-s = 14 | ||
+ | }}</pre> || colspan="2"| {{Userbox|id=foo logo|id-s=14|id-lh=1.1em|id-c=#ffe|info=foo bar|info-c=#fef|info-s=14|border-c=#afa|border-s=2}} <br style="clear:both"> <br /> {{Userbox|id=foo logo|id-s=14|id-lh=1.1em|id-c=#ffe|info=foo bar|info-c=#fef|info-s=14|info-op=font-family:'Courier New'; text-align:center;|border-c=#afa|border-s=2}} | ||
+ | |}<!-- customize if needed to illustrate parameter use --> | ||
+ | |||
+ | == 模板数据 == | ||
+ | {{TemplateDataHeader}} | ||
+ | |||
+ | <templatedata> | ||
+ | { | ||
+ | "description": "本模板適用於建置用戶框,提供使用者在用戶頁面顯示使用者的一些資訊,以免於HTML與Wikitable參數的麻煩。", | ||
+ | "params": { | ||
+ | "bodyclass": { | ||
+ | "label": "bodyclass", | ||
+ | "description": "自訂HTML Class參數", | ||
+ | "type": "string", | ||
+ | "default": "id-c" | ||
+ | }, | ||
+ | "border-c": { | ||
+ | "label": "border-c", | ||
+ | "description": "邊框色彩", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "border-s": { | ||
+ | "label": "border-s", | ||
+ | "description": "邊框像素大小", | ||
+ | "type": "string", | ||
+ | "default": "1" | ||
+ | }, | ||
+ | "float": { | ||
+ | "label": "float", | ||
+ | "description": "流動對齊方式 left|right|none", | ||
+ | "type": "string", | ||
+ | "default": "left" | ||
+ | }, | ||
+ | "id": { | ||
+ | "label": "id", | ||
+ | "description": "id 圖片或文字(選用)", | ||
+ | "type": "string", | ||
+ | "default": "x45px" | ||
+ | }, | ||
+ | "id-a": { | ||
+ | "label": "id-a", | ||
+ | "description": "id 水平對齊方式 left/center/right/justify", | ||
+ | "type": "string", | ||
+ | "default": "center" | ||
+ | }, | ||
+ | "id-c": { | ||
+ | "label": "id-c", | ||
+ | "description": "id 的背景色彩", | ||
+ | "type": "string", | ||
+ | "default": "#d0d0d0" | ||
+ | }, | ||
+ | "id-fc": { | ||
+ | "label": "id-fc", | ||
+ | "description": "id 的文字色彩", | ||
+ | "type": "string", | ||
+ | "default": "black" | ||
+ | }, | ||
+ | "id-h": { | ||
+ | "label": "id-h", | ||
+ | "description": "id 框的像素大小", | ||
+ | "type": "string", | ||
+ | "default": "45" | ||
+ | }, | ||
+ | "id-lh": { | ||
+ | "label": "id-lh", | ||
+ | "description": "id 行高", | ||
+ | "type": "string", | ||
+ | "default": "1em" | ||
+ | }, | ||
+ | "id-op": { | ||
+ | "label": "id-op", | ||
+ | "description": "id 的其他 CSS 參數", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "id-p": { | ||
+ | "label": "id-p", | ||
+ | "description": "id 的儲存格留白值", | ||
+ | "type": "string", | ||
+ | "default": "0 1px 0 0" | ||
+ | }, | ||
+ | "id-s": { | ||
+ | "label": "id-s", | ||
+ | "description": "id 文字點數", | ||
+ | "type": "string", | ||
+ | "default": "14" | ||
+ | }, | ||
+ | "id-w": { | ||
+ | "label": "id-w", | ||
+ | "description": "id 框長度,單位是像素", | ||
+ | "type": "string", | ||
+ | "default": "45" | ||
+ | }, | ||
+ | "info-class": { | ||
+ | "label": "info-class", | ||
+ | "description": "Adds an HTML class attribute to the “info” HTML table-row, to allow for styling, emission of microformats, etc.", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "info": { | ||
+ | "label": "info", | ||
+ | "description": "info 框圖文內容", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "info-a": { | ||
+ | "label": "info-a", | ||
+ | "description": "info 框水平對齊方式 left/center/right/justify", | ||
+ | "type": "string", | ||
+ | "default": "left" | ||
+ | }, | ||
+ | "info-c": { | ||
+ | "label": "info-c", | ||
+ | "description": "info 框背景色", | ||
+ | "type": "string", | ||
+ | "default": "#e0e0e0" | ||
+ | }, | ||
+ | "info-fc": { | ||
+ | "label": "info-fc", | ||
+ | "description": "info 框文字色彩", | ||
+ | "type": "string", | ||
+ | "default": "black" | ||
+ | }, | ||
+ | "info-lh": { | ||
+ | "label": "info-lh", | ||
+ | "description": "info 框行高", | ||
+ | "type": "string", | ||
+ | "default": "1.25em" | ||
+ | }, | ||
+ | "info-op": { | ||
+ | "label": "info-op", | ||
+ | "description": "info 框的其他CSS樣式參數", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "info-p": { | ||
+ | "label": "info-p", | ||
+ | "description": "info 框的留白值", | ||
+ | "type": "string", | ||
+ | "default": "0 4px 0 4px" | ||
+ | }, | ||
+ | "info-s": { | ||
+ | "label": "info-s", | ||
+ | "description": "info 文字點數", | ||
+ | "type": "string", | ||
+ | "default": "8" | ||
+ | }, | ||
+ | "nocat": { | ||
+ | "label": "nocat", | ||
+ | "description": "屏蔽頁面分類", | ||
+ | "type": "string", | ||
+ | "default": "false" | ||
+ | }, | ||
+ | "usercategory": { | ||
+ | "label": "usercategory", | ||
+ | "description": "使用者自設分類(選用)", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "usercategory2": { | ||
+ | "label": "usercategory2", | ||
+ | "description": "使用者自設分類(選用)", | ||
+ | "type": "string" | ||
+ | }, | ||
+ | "usercategory3": { | ||
+ | "label": "usercategory3", | ||
+ | "description": "使用者自設分類(選用)", | ||
+ | "type": "string" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </templatedata> | ||
+ | |||
+ | == 参见 == | ||
+ | * [[维基百科:用户框]] | ||
+ | * {{Tlx|Userbox-2}}:左右两边都有id区的用户框。 | ||
+ | * {{Tlx|Userbox-r}}:右边有id区的用户框。 | ||
+ | * {{Tlx|Userbox-m}}:只有id区的用户框。 | ||
+ | * [[网页颜色]] | ||
+ | |||
+ | ==微格式== | ||
+ | ;bodyclass : This parameter is inserted into the "class" attribute for the userbox as a whole. | ||
+ | ;info-class : This parameter is inserted into the "class" attribute for the info component. | ||
+ | |||
+ | This template supports the addition of [[microformat]] information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. To flag a userbox as containing [[hCard]] information about a person, for example, add the following parameter: | ||
+ | |||
+ | <pre> | ||
+ | |bodyclass = vcard | ||
+ | </pre> | ||
+ | |||
+ | ''or'' | ||
+ | |||
+ | <pre> | ||
+ | |info-class = vcard | ||
+ | </pre> | ||
+ | |||
+ | ''then'' (for example): | ||
+ | |||
+ | <pre> | ||
+ | |title = ... the books of <span class="fn">[[Iain Banks]]</span> | ||
+ | </pre> | ||
+ | |||
+ | ... and so forth. | ||
+ | |||
+ | Examples include: | ||
+ | |||
+ | * [[:en:User:UBX/Iain Banks]] - person | ||
+ | * [[:en:Template:User Microformats]] - group (WikiProject Microformats) | ||
+ | * [[:en:Template:User Brum]] - place (Birmingham) | ||
+ | |||
+ | 有關微格式的參數設置,請參考[[Wikipedia:專題/微格式|微格式專題]]。 | ||
+ | |||
+ | <includeonly>{{sandbox other|| | ||
+ | <!-- 本行下加入模板的分類,跨維基連結加入Wikidata(參見[[Wikipedia:Wikidata]]) --> | ||
+ | [[Category:用户框模板| ]] | ||
+ | [[Category:Akarin元模板|用戶框]] | ||
+ | }}</includeonly> |
2021年1月15日 (五) 23:03的最新版本
此頁面是Template:Userbox的Templatedocumentation。 此頁面可能包含了模板的使用說明、分類和其他内容。 |
此模板使用Lua语言: |
此Templatedocumentation被引用於約25,000個頁面中。 為了避免造成大規模的影響,所有對此Templatedocumentation的編輯應先於沙盒、測試樣例或您的使用者頁面上測試。 測試後無誤的版本可以一次性地加入此Templatedocumentation中,但是修改前請務必於討論頁發起討論。 |
模板介紹
本模板適用於建置用戶框,提供使用者在用戶頁面顯示使用者的一些資訊,以免於HTML與Wikitable參數的麻煩。
合理使用圖像不得用於用戶框,任何使用者可在不經對方同意下,移除相關圖片。
使用方式
{{Userbox |bodyclass = <!--自訂HTML Class參數--> |border-c = <!--邊框色彩 (預設與 id-c 之參數相同)--> |border-s = <!--邊框像素大小 (預設值:1)--> |float = <!--流動對齊方式 left|right|none (預設值:left)--> |id = <!--id 圖片或文字(選用,預設尺寸是x45px)--> |id-a = <!--id 水平對齊方式 left/center/right/justify (預設:center)--> |id-c = <!--id 的背景色彩 (預設:#d0d0d0)--> |id-fc = <!--id 的文字色彩 (預設:black)--> |id-h = <!--id 框的像素大小 (預設:45)--> |id-lh = <!--id 行高 (預設:1em)--> |id-op = <!--id 的其他 CSS 參數--> |id-p = <!--id 的儲存格留白值 (預設:0 1px 0 0)--> |id-s = <!--id 文字點數 (預設:14)--> |id-w = <!--id 框長度 (預設:45)--> |info-class = <!--Adds an HTML class attribute to the "info" HTML table-row, to allow for styling, emission of microformats, etc.--> |info = <!--info 框圖文內容--> |info-a = <!--info 框水平對齊方式 left/center/right/justify (預設:left)--> |info-c = <!--info 框背景色 (預設:#e0e0e0)--> |info-fc = <!--info 框文字色彩 (預設:black)--> |info-lh = <!--info 框行高 (預設:1.25em)--> |info-op = <!--info 框的其他CSS樣式參數--> |info-p = <!--info 框的留白值 (預設:0 4px 0 4px)--> |info-s = <!--info 文字點數 (預設:8)--> |nocat = <!--屏蔽頁面分類 (預設:false)--> |usercategory = <!--使用者自設分類(選用)--> |usercategory2 = <!--使用者自設分類(選用)--> |usercategory3 = <!--使用者自設分類(選用)--> }}
- 全部參數皆為選填
- 圖像建議少於45px
多数基于HTML的表格仅用这些参数的一小部分。以下子集可以用来把HTML用户框快速转换成这里所用的格式:
{{Userbox |border-c = |id = |id-c = |id-fc = |id-s = |info = |info-c = |info-fc = |info-lh = |info-s = |nocat = {{{nocat|}}} |usercategory = }}
範例
代码 | 效果 | |||||
---|---|---|---|---|---|---|
{{Userbox}} |
| |||||
{{Userbox |border-c = #aaffaa |border-s = 2 |id = foo |id-c = #ffffee |id-s = 20 |info = ''foo bar'' |info-c = #ffeeff |info-s = 12 }} |
| |||||
以下展示高度超过45px的用户框的默认外观,比较一下上下两个用户框的差异。 | ||||||
{{Userbox |border-c = #aaffaa |border-s = 2 |id = foo logo |id-c = #ffffee |info = ''We are trying to see default distance in between text lines, see the distance in between cell content and its border, and also see total height.'' |info-c = #ffeeff }} |
| |||||
以下展示怎样能修改用户框并进一步指定参数来降低用户框的高度以达到推荐的45px,即使有四行文字。在四行文字之下,单元格边距参数info-p也可以设置成1pt 1pt 1pt 2pt,或者1pt 2pt以达到更好的效果。 | ||||||
{{Userbox |border-c = #aaffaa |border-s = 1 |id = foo logo |id-c = #ffffee |id-lh = 1.1em |id-s = 14 |info = ''We have specified values to lessen the distance in between text lines & padding space in between cell content and its border.'' |info-c = #ffeeff |info-lh = 1.05em |info-p = 1pt |info-s = 8 }} |
| |||||
以下针对高级用户,展示怎样指定其他CSS属性,例如,font-family调整字体,text-align从默认参数调整对齐方式。如下所示,右边是2个用户框:上面一个是不带font-family或text-align参数;下面一个是以填写info-op参数来使用此类代码显示的。 | ||||||
{{Userbox |border-c = #afa |border-s = 2 |id = foo logo |id-c = #ffe |id-lh = 1.1em |id-s = 14 |info = foo bar |info-c = #fef |info-op = font-family:'Courier New'; text-align:center; |info-s = 14 }} |
|
模板数据
本模板適用於建置用戶框,提供使用者在用戶頁面顯示使用者的一些資訊,以免於HTML與Wikitable參數的麻煩。
参数 | 说明 | 类型 | 状态 | |
---|---|---|---|---|
bodyclass | bodyclass | 自訂HTML Class參數
| 字符串 | 可选 |
border-c | border-c | 邊框色彩 | 字符串 | 可选 |
border-s | border-s | 邊框像素大小
| 字符串 | 可选 |
float | float | 流動對齊方式 left|right|none
| 字符串 | 可选 |
id | id | id 圖片或文字(選用)
| 字符串 | 可选 |
id-a | id-a | id 水平對齊方式 left/center/right/justify
| 字符串 | 可选 |
id-c | id-c | id 的背景色彩
| 字符串 | 可选 |
id-fc | id-fc | id 的文字色彩
| 字符串 | 可选 |
id-h | id-h | id 框的像素大小
| 字符串 | 可选 |
id-lh | id-lh | id 行高
| 字符串 | 可选 |
id-op | id-op | id 的其他 CSS 參數 | 字符串 | 可选 |
id-p | id-p | id 的儲存格留白值
| 字符串 | 可选 |
id-s | id-s | id 文字點數
| 字符串 | 可选 |
id-w | id-w | id 框長度,單位是像素
| 字符串 | 可选 |
info-class | info-class | Adds an HTML class attribute to the “info” HTML table-row, to allow for styling, emission of microformats, etc. | 字符串 | 可选 |
info | info | info 框圖文內容 | 字符串 | 可选 |
info-a | info-a | info 框水平對齊方式 left/center/right/justify
| 字符串 | 可选 |
info-c | info-c | info 框背景色
| 字符串 | 可选 |
info-fc | info-fc | info 框文字色彩
| 字符串 | 可选 |
info-lh | info-lh | info 框行高
| 字符串 | 可选 |
info-op | info-op | info 框的其他CSS樣式參數 | 字符串 | 可选 |
info-p | info-p | info 框的留白值
| 字符串 | 可选 |
info-s | info-s | info 文字點數
| 字符串 | 可选 |
nocat | nocat | 屏蔽頁面分類
| 字符串 | 可选 |
usercategory | usercategory | 使用者自設分類(選用) | 字符串 | 可选 |
usercategory2 | usercategory2 | 使用者自設分類(選用) | 字符串 | 可选 |
usercategory3 | usercategory3 | 使用者自設分類(選用) | 字符串 | 可选 |
参见
微格式
- bodyclass
- This parameter is inserted into the "class" attribute for the userbox as a whole.
- info-class
- This parameter is inserted into the "class" attribute for the info component.
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. To flag a userbox as containing hCard information about a person, for example, add the following parameter:
|bodyclass = vcard
or
|info-class = vcard
then (for example):
|title = ... the books of <span class="fn">[[Iain Banks]]</span>
... and so forth.
Examples include:
- en:User:UBX/Iain Banks - person
- en:Template:User Microformats - group (WikiProject Microformats)
- en:Template:User Brum - place (Birmingham)
有關微格式的參數設置,請參考微格式專題。