本模板适用于建置用户框,提供使用者在用户页面显示使用者的一些资讯,以免于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 =
}}