本模板適用於建置用戶框,提供使用者在用戶頁面顯示使用者的一些資訊,以免於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 = <!--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)-->
| usercategory = <!--使用者自設分類(選用)-->
| usercategory2 = <!--使用者自設分類(選用)-->
}}
代碼
|
效果
|
{{userbox-r}} |
|
{{userbox-r
| id = foo
| id-s = 20
| id-c = #ffffee
| info = ''foo bar''
| info-c = #ffeeff
| info-s = 12
| border-c = #aaffaa
| border-s = 2
}} |
|
以下展示高度超過45px的用戶框的默認外觀,比較一下上下兩個用戶框的差異。
|
{{userbox-r
| id = foo logo
| id-c = #ffffee
| info = ''We are trying to see
default distance in between text
lines, and, see the distance in
between cell content and its border
and also see total height.''
| info-c = #ffeeff
| border-c = #aaffaa
| border-s = 2
}} |
We are trying to see default distance in between text lines, and, see the distance in between cell content and its border and also see total height. | foo logo |
|
以下展示怎樣能修改用戶框並進一步指定參數來降低用戶框的高度以達到推薦的45px,即使有四行文字。在四行文字之下,單元格邊距參數info-p也可以設置成1pt 1pt 1pt 2pt,或者1pt 2pt以達到更好的效果。
|
{{userbox-r
| id = foo logo
| id-s = 14
| id-c = #ffffee
| id-lh = 1.1em
| 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
}} |
We have specified values to lessen the distance in between text lines & padding space in between cell content and its border. | foo logo |
|
以下針對高級用戶,展示怎樣指定其他CSS屬性,例如,font-family調整字體家族,text-align從默認參數調整對齊方式。如下所示,右邊是2個用戶框:上面一個是不帶font-family或text-align參數;下面一個是以填寫info-op參數來使用此類代碼顯示的。
|
{{userbox-r
| id = foo logo
| id-s = 14
| id-c = #ffe
| id-lh = 1.1em
| info = foo bar
| info-c = #fef
| info-s = 14
| info-op = font-family:'Courier New';
| border-c = #afa
| border-s = 2
}} |
|
多數基於HTML的表格僅用這些參數的一小部分。以下子集可以用來把HTML用戶框快速轉換成這裡所用的格式:
{{userbox-r
| border-c =
| info-c =
| id-c =
| id-fc =
| id-s =
| id =
| info-fc =
| info-s =
| info-lh =
| info =
}}