User:Ring/Userbox

From Guild Wars Wiki
Jump to navigationJump to search
id
info


Usage[edit]

{{User:Ring/Userbox| 1(type) | 2(id) | 3(info) | 4(id-c) | 5(info-c) | <named parameters>=...}}

Parameters[edit]

width (Default: 242px)
overall width of userbox
height (Default: 49px)
overall height of the userbox
margin (Default: 1)
outer distance to neighboring elements in pixel
float (Default: left)
floating behaviour; one of left, right or none
border-width, border-s (Default: 1px)
width of outer border
border-color, border-c (Default: {{Any-color|border}})
border color (equals id-c if that is specified but neither border-c nor 1 are)
border-style (Default: solid)
style of the outer border, e.g. dashed or dotted
logo, id (Default: id)
the actual "logo" or logo-text; if empty, the logo area will be hidden
id-type (Default: text)
one of text, img or skill
id-crop (Default: 1 for img, 3 for skill)
pixel to "cut off" around images
logo-background, id-c (Default: {{Any-color|background}})
background of the logo area (and of borders unless otherwise specified)
logo-color, id-fc (Default: black)
font color in the logo area
logo-border, id-b
if specified, the id area will have a right border with specified width
logo-size, id-s (Default: 14pt)
font size in the logo area
logo-padding, id-p (Default: 1pt for text, 0 for img/skill)
padding in the logo box
logo-line-height, id-lh (Default: 1.25em)
line height in the logo box
logo-valign, id-va (Default: middle)
vertical alignment of logo-text or image; e.g. top or bottom
logo-halign, id-ha (Default: center)
horizontal alignment of logo-text or image; one of left, center, right or justify
logo-weight, id-w (Default: bold)
defines boldness (font weight) of the text in the logo area
logo-other-param, id-op
other CSS properties you want to specify
info (Default: info)
the actual text/image in the info part
info-background, info-c (Default: {{Any-color|tint}})
background color of the info area
info-size, info-s (Default: 8pt)
font size in the info area
info-color, info-fc (Default: black)
font color in the info area
info-padding, info-p (Default: 4pt)
padding in the info area, including units
info-line-height, info-lh (Default: 1.25em)
line height in the info
info-valign, info-va (Default: middle)
vertical alignment of content in the info area; e.g. top or bottom
info-halign, info-ha (Default: left)
horizontal alignment of content in the info area; one of left, center, right or justify
info-other-param, info-op
other CSS properties you want to specify

Dimensions[edit]

Basically, there are two modes of how to specify dimensions for border, margin, padding (id), height and width:

  1. Not specifying any units at all
    Height and width of the box will include padding, margin and border. The image size will be calculated taking padding into account (if applicable). All units concerning border size, height, width, margin or padding are in pixel (px) by default.
  2. Specifying all units
    As soon as you specify units in either one of the parameters, calculation of the total dimensions fails (or, at least, yields strange results). Then:
    • width defaults to 238px and specifies the total width of the box excluding border and margin
    • height defaults to 45px and might or might not specify the height of the box and width of the logo area, excluding border and margin, not taking padding into account
    • image cropping will most likely fail
    This should then resemble the behaviour of the original userbox template.

Note: Although logo padding has a default value of 1pt for text, as soon as you specify an integer without units it will be in pixel. Also, info padding is not important for any of that and always specified including units.

id-type & -crop[edit]

The following types are available:

  1. text
    can be omitted; places the text specified via id or logo in the corresponding box; ignores cropping
  2. img
    id or logo should be a name of an image (not the wiki markup, just the name); If id-crop is set (which it is by default), some pixel will be cut off around the image; If logo-size/id-s is specified, that value will be used for image size (not recommended, though)
  3. skill
    convenience type; id/logo should be the name of a skill image; should remove the black or gold borders around the image
  • Default padding for img/skill is 0! (1pt for text)
  • img/skill and crop currently work with square images only; Additional parameters for non-square images might be implemented (or DIY...)
  • Consider using logo-border/id-b with images, as without it the right padding might look less than the left one

Examples[edit]

{{User:Ring/Userbox||{{ }}|1. simple, text-only userbox example}}
{{User:Ring/Userbox|img|User Jora fan.jpg|2. full size image including default 1px cropping|{{W-color|border}}|{{W-color|tint}}}}
{{User:Ring/Userbox|img|Pounce.jpg|3. skill image (img mode) with 2px padding|{{R-color|border}}|{{R-color|tint}}|id-p=2|id-c={{R-color|background}}}}
{{User:Ring/Userbox|skill|Ursan Strike.jpg|4. cropped skill image with id border|{{P-color|border}}|{{P-color|tint}}|id-b=1}}
{{User:Ring/Userbox|skill|Heal as One.jpg|5. padded skill image with border|{{R-color|background}}|{{R-color|tint}}|border-c={{R-color|border}}|id-p=2|id-b=1}}
{{User:Ring/Userbox|skill|Hunt Rampage (Asura).png|6. skill image w/o padding, crop, border|{{Rt-color|border}}|{{Rt-color|tint}}|id-crop=0}}
{{User:Ring/Userbox|img|User Nian Melandru.jpg|7. thicker, dotted border, image auto-sized|{{R-color|border}}|{{R-color|tint}}|border-s=5|border-style=dotted}}
{{User:Ring/Userbox|img|info=8. default image, no crop, 5px margin|id-crop=0|margin=5}}
{{ }}
1. simple, text-only userbox example
User Jora fan.jpg
2. full size image including default 1px cropping
Pounce.jpg
3. skill image (img mode) with 2px padding
Ursan Strike.jpg
4. cropped skill image with id border
Heal as One.jpg
5. padded skill image with border
Hunt Rampage (Asura).png
6. skill image w/o padding, crop, border
User Nian Melandru.jpg
7. thicker, dotted border, image auto-sized
Main Wiki.png
8. default image, no crop, 5px margin


Notes[edit]

  • This template allows a huge amount of variation. Nevertheless,
  • Based upon Template:Userbox (see changes below)
  • Try to limit the text in the info area to two lines or less - or change line height, font size and padding to retain the default dimensions
  • In order to avoid the small gap at the top of linked images in IE, 1px of an image are crooped by default (for type=img). However, the visibility of the image might vary between browsers.
  • Image size calculation (esp. implementation of logo-size/id-s) might be changed in future; Handle with care!
  • Tested with Firefox 3.0, Internet Explorer 7.0, Opera 9.63 and Google Chrome 1.0

Additions[edit]

  • Support for (skill) images
  • Support for border between id and info areas
  • Automatic dimension calculation
  • More properties can be specified

Changes[edit]

  • Bold text implemented as CSS property as opposed to bold-tag; therefore, it is safe to put block elements in id/logo field
  • Some named parameters override unnamed counterparts
  • Some differences in specification of units

Plans[edit]

  • Support for right (second) id cell
  • Alternate crop mode
  • Better image size support