模板:Userbox
id | info |
---|
模板介绍
编辑本模板适用于建置用户框,提供使用者在用户页面显示使用者的一些资讯,以免于HTML与Wikitable参数的麻烦。
合理使用图像不得用于用户框,任何使用者可在不经对方同意下,移除相关图片。
使用方式
编辑{{userbox | bodyclass = <!--自訂HTML Class參數--> | border-c = <!--邊框色彩 (預設與 id-c 之參數相同)--> | border-s = <!--邊框像素大小 (預設值:1)--> | float = <!--流動對齊方式 left|right|none (預設值:left)--> | id = <!--id 圖片或文字--> | id-a = <!--id 水平對齊方式 left/center/right/justify (預設:center)--> | id-c = <!--id 的背景色彩 (預設:#d0d0d0)--> | id-fc = <!--id 的文字色彩 (預設:black)--> | id-h = <!--id 框的像素大小 (預設:45)--> | id-lh = <!--id 行高 (預設:1.25em)--> | 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 文字點數 (預設:9)--> | nocat = <!--block page category declarations (default=false)--> | usercategory = <!--使用者自設分類(選用)--> | usercategory2 = <!--使用者自設分類(選用)--> | usercategory3 = <!--使用者自設分類(選用)--> }}
- 全部参数皆为选填
- 图像建议少于45px
Most HTML-based tables use only a handful of these attributes. The following subset can be used to quickly convert an HTML userbox into the format used here:
{{userbox | border-c = | id = | id-c = | id-fc = | id-s = | info = | info-c = | info-fc = | info-lh = | info-s = | nocat = {{{nocat|}}} | usercategory = }}
范例
编辑Code | Result | |||||
---|---|---|---|---|---|---|
{{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 }} |
| |||||
Below example shows the default appearance of a userbox, which is (much) higher than the 45px. Compare the height of the one below with the above userbox. | ||||||
{{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 }} |
| |||||
Below example shows how we can change that userbox and further specify parameters to bring down the overall height of the userbox to the recommended height of 45px, even with four text lines. Cell padding parameter "info-p" can also be set at "1pt 1pt 1pt 2pt", or "1pt 2pt" for better appearance, when there are 4 text lines. | ||||||
{{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 }} |
| |||||
Below example is for advanced users, showing how we can specify other CSS properties, for example, "font-family", to change the font or "text-align" to change the alignment from the default parameters. At below, on the right side are two userboxes: top one is displayed without the "font-family" or "text-align" parameters; and the bottom userbox is displayed by using the below codes, with the help of the "info-op" field. | ||||||
{{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 }} |
|
Microformats
编辑- 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.
有关微格式的参数设置,请参考微格式专题。
上述文档嵌入自Template:Userbox/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。 本模板的子页面。 |