模板:Userbox

本頁使用了標題或全文手工轉換
被永久保護的模板
維基百科,自由的百科全書
{{{info}}}
文件圖示 模板文件[檢視] [編輯] [歷史] [清除快取]

模板介紹

本模板適用於建置使用者方塊,提供使用者在使用者頁面面顯示使用者的一些資訊,以免於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}}
{{{info}}}
{{Userbox
|border-c = #aaffaa
|border-s = 2
|id       = foo
|id-c     = #ffffee
|id-s     = 20
|info     = ''foo bar''
|info-c   = #ffeeff
|info-s   = 12
}}
foofoo bar
以下展示高度超過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
}}
foo logoWe 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.
以下展示怎樣能修改使用者方塊並進一步指定參數來降低使用者方塊的高度以達到推薦的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
}}
foo logoWe have specified values to lessen the distance in between text lines & padding space in between cell content and its border.
以下針對進階使用者,展示怎樣指定其他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
}}
foo logofoo bar

 
foo logofoo bar

模板資料

以下是該模板的模板資料,適用於視覺化編輯器等工具。

Userbox模板資料

本模板適用於建置使用者方塊,提供使用者在使用者頁面面顯示使用者的一些資訊,以免於HTML與Wikitable參數的麻煩。

模板參數[編輯模板資料]

參數描述類型狀態
bodyclassbodyclass

自訂HTML Class參數

預設
id-c
字串非必填
border-cborder-c

邊框色彩

字串非必填
border-sborder-s

邊框像素大小

預設
1
字串非必填
floatfloat

流動對齊方式 left|right|none

預設
left
字串非必填
idid

id 圖片或文字(選用)

預設
x45px
字串非必填
id-aid-a

id 水平對齊方式 left/center/right/justify

預設
center
字串非必填
id-cid-c

id 的背景色彩

預設
#d0d0d0
字串非必填
id-fcid-fc

id 的文字色彩

預設
black
字串非必填
id-hid-h

id 框的像素大小

預設
45
字串非必填
id-lhid-lh

id 行高

預設
1em
字串非必填
id-opid-op

id 的其他 CSS 參數

字串非必填
id-pid-p

id 的儲存格留白值

預設
0 1px 0 0
字串非必填
id-sid-s

id 文字點數

預設
14
字串非必填
id-wid-w

id 框長度,單位是像素

預設
45
字串非必填
info-classinfo-class

Adds an HTML class attribute to the &ldquo;info&rdquo; HTML table-row, to allow for styling, emission of microformats, etc.

字串非必填
infoinfo

info 框圖文內容

字串非必填
info-ainfo-a

info 框水平對齊方式 left/center/right/justify

預設
left
字串非必填
info-cinfo-c

info 框背景色

預設
#e0e0e0
字串非必填
info-fcinfo-fc

info 框文字色彩

預設
black
字串非必填
info-lhinfo-lh

info 框行高

預設
1.25em
字串非必填
info-opinfo-op

info 框的其他CSS樣式參數

字串非必填
info-pinfo-p

info 框的留白值

預設
0 4px 0 4px
字串非必填
info-sinfo-s

info 文字點數

預設
8
字串非必填
nocatnocat

封鎖頁面分類

預設
false
字串非必填
usercategoryusercategory

使用者自設分類(選用)

字串非必填
usercategory2usercategory2

使用者自設分類(選用)

字串非必填
usercategory3usercategory3

使用者自設分類(選用)

字串非必填

重新導向

參見

微格式

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:

有關微格式的偏好設定,請參考微格式專題