Template:Userbox
(Redirected from Template:UB)
Jump to navigation
Jump to search
| Parts of this template were originally sporked from w:Template:Userbox. |
| This template uses Lua: |
| This template uses TemplateStyles: |
Userbox template for Category:User page templates. Current version merges support for both standard Wikipedia-style usage and weird old parameters, so we don't have to rewrite approximately 1,000 userbox templates.
Note: This Lua module generates properly-nested HTML, fixing a parser quirk in the old template where tables could escape their containers. If your userbox layout changed, you can adjust it using the float, margin, or width parameters.
Usage
Standard usage
{{userbox
| border-c = #8B4513
| id = [[File:Coffee cup icon.svg|45px]]
| id-c = #D2691E <!--id background color-->
| id-fc = #FFFFFF <!--id font color-->
| id-s = 14 <!--id font size (in pts)-->
| info = This user runs on '''coffee''' and cannot function before their first cup. <--info text-->
| info-c = #F5DEB3 <!--info background color-->
| info-fc = #000000 <!--info font color-->
| info-lh = 1.25em <!--info line-height-->
| info-s = 10 <!--info text size (in pts)-->
}}
For example, the code above will produce the userbox you see below:
Standard parameters
- Common parameters
{{userbox
| border-c =
| id =
| id-c =
| id-fc =
| id-s =
| info =
| info-c =
| info-fc =
| info-lh =
| info-s =
}}
- All parameters
{{Userbox
| bodyclass = <!--Adds an HTML class attribute to the entire template's HTML table, to allow for styling, emission of microformats, etc.-->
| border-c = <!--border color (default=id-c or #999)-->
| border-s = <!--border width in pixels (default=1)-->
| float = <!--left|right|none (default=left)-->
| id = <!--id image or text (image size should normally not exceed 90x45px)-->
| id-a = <!--id horizontal alignment left/center/right/justify (default=center)-->
| id-c = <!--id background color (default=#ddd)-->
| id-fc = <!--id font color (default=info-fc or black)-->
| id-h = <!--id box height in pixels (default=45)-->
| id-lh = <!--id line height (default=1.25em)-->
| id-op = <!--id other CSS parameters-->
| id-p = <!--id cell padding (default=0)-->
| id-s = <!--id text size in points (default=14)-->
| id-w = <!--id box width in pixels (default=45)-->
| info-class = <!--Adds an HTML class attribute to the "info" HTML table-row, to allow for styling, emission of microformats, etc.-->
| info = <!--info text or image-->
| info-a = <!--info horizontal alignment left/center/right/justify (default=left)-->
| info-c = <!--info background color (default=#eee)-->
| info-fc = <!--info font color (default=black)-->
| info-lh = <!--info line height (default=1.25em)-->
| info-op = <!--info other CSS parameters-->
| info-p = <!--info padding (default=0 4px 0 4px)-->
| info-s = <!--info text size in points (default=8)-->
| nocat = <!--block page category declarations; see [[WP:NOCAT]] (default=false)-->
| usercategory = <!--user category (optional, unlinked and without the "Category:" part)-->
| usercategory2 = <!--user category (optional)-->
| usercategory3 = <!--user category (optional)-->
| usercategory4 = <!--user category (optional)-->
| usercategory5 = <!--user category (optional)-->
}}
Old parameters
- 1 = border color and side background color (image area)
- border = full border (1px solid <b>)
- 2 or bg = background color
- 3 or img = full image or text insertion for left side area
- id = custom ID (UBOX)
- color = text color (both areas)
Text Area Controls
- p = text padding (4pt)
- pl = text padding-left (4pt)
- ta = text-align (left)
- lh = line-height (1.25em)
- 5 or fs = font-size (10pt)
- 6 or c = font color (inherit)
- styles = custom styles
Image Area Controls
- sc = side font color (inherit)
- sp = side padding (0)
- s = side background color
- ss = side font size for text insertion (14pt)
- sw = side width (45px) **This must be set to the same width as your image
- h = height (45px)
- fw = font weight for text insertion
- is = custom side area styles
Stuff You Shouldn't Have to Change
- b = secondary outer border (0)
- float = let the user set this, but you may need to change the secondary parameter for the passed 'float' value (none)
- bs = box styles
- os = optional outside div styles