Template:UserTemplate: Difference between revisions

From The Urban Dead Wiki
Jump to navigationJump to search
mNo edit summary
 
m (default font-size redefined to absolute CSS values to prevent font scaling when nested)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{| style="margin: {{{margintopbottom|auto}}} {{{marginleftright|inherit}}}; border: {{{borderwidth|2px}}} {{{borderstyle|solid}}} {{{bordercolor|black}}}; width: {{{width|250px}}}; padding: {{{padding|auto}}}; background: {{{background|auto}}}; font-size: {{{fontsize|auto}}}"
{|style="margin:{{{margintopbottom|auto}}} {{{marginleftright|0}}};border:{{{borderwidth|2px}}} {{{borderstyle|solid}}} {{{bordercolor|black}}};width:{{{width|250px}}};padding:{{{padding|0}}};background:{{{background|white}}};font-size:{{{fontsize|medium}}}"
|rowspan="2" style="padding: {{{imagepadding|auto}}}" |[[Image:{{{image}}}|{{{imagewidth|60px}}}]]||style="background: {{{headerbackground|black}}}; color: {{{headercolor|white}}}; font-size: {{{headerfontsize|85%}}}; line-height: {{{headerlineheight|16px}}}; text-align: {{{headeralign|center}}}; width: 100%; height: {{{headerheight|auto}}}"|{{{headertext}}}
|rowspan=2 style="padding:{{{imagepadding|0}}}"|[[Image:{{{image|Example.jpg}}}|{{{imagewidth|60px}}}]]
|style="background:{{{headerbackground|black}}};color:{{{headercolor|white}}};font-size:{{{headerfontsize|small}}};line-height:{{{headerlineheight|1.5}}};text-align:{{{headeralign|center}}};height: {{{headerheight|auto}}};width:100%"|{{{headertext}}}
|-
|-
|style="font-size: {{{mainfontsize|xx-small}}}; text-align: {{{mainalign|center}}}; line-height: {{{mainlineheight|auto}}}; background: {{{mainbackground|auto}}}; color: {{{maincolor|auto}}}; padding: {{{mainpadding|auto}}}"|{{{maintext}}}
|style="font-size:{{{mainfontsize|xx-small}}};text-align:{{{mainalign|center}}};line-height:{{{mainlineheight|2}}};background:{{{mainbackground|transparent}}};color:{{{maincolor|black}}};padding:{{{mainpadding|0}}}"|{{{maintext}}}
|}</includeonly><noinclude>
|}<noinclude>
==Usage==
==Usage==
{{Code|
<nowiki>
&#123;&#123;UserTemplate&#124;<br />
{{UserTemplate
margintopbottom&#61;''size''&#124;<br />
|margintopbottom=size
marginleftright&#61;''size''&#124;<br />
|marginleftright=size
borderwidth&#61;''size''&#124;<br />
|borderwidth=size
borderstyle&#61;''style''&#124;<br />
|borderstyle=style
bordercolor&#61;''color''&#124;<br />
|bordercolor=color
width&#61;''size''&#124;<br />
|width=size
padding&#61;''size''&#124;<br />
|padding=size
background&#61;''color''&#124;<br />
|background=color
fontsize&#61;''size''&#124;<br />
|fontsize=size
imagepadding&#61;''size''&#124;<br />
|imagepadding=size
image&#61;''name''&#124;<br />
|image=name
imagewidth&#61;''size''&#124;<br />
|imagewidth=size
headerbackground&#61;''color''&#124;<br />
|headerbackground=color
headercolor&#61;''color''&#124;<br />
|headercolor=color
headerfontsize&#61;''size''&#124;<br />
|headerfontsize=size
headerlineheight&#61;''size''&#124;<br />
|headerlineheight=size
headeralign&#61;''alignment''&#124;<br />
|headeralign=alignment
headerheight&#61;''size''&#124;<br />
|headerheight=size
headertext&#61;''text''&#124;<br />
|headertext=text
mainfontsize&#61;''size''&#124;<br />
|mainfontsize=size
mainalign&#61;''alignment''&#124;<br />
|mainalign=alignment
mainlineheight&#61;''size''&#124;<br />
|mainlineheight=size
mainbackground&#61;''color''&#124;<br />
|mainbackground=color
maincolor&#61;''color''&#124;<br />
|maincolor=color
mainpadding&#61;''size''&#124;<br />
|mainpadding=size
maintext&#61;''text''&#125;&#125;
|maintext=text
}}
}}
</nowiki>


This template is the mother of all user box templates. Most of its attributes can be left out, and will assume default values:
This template is the mother of all user box templates. You need only define a few variables to get it to function. But you can adjust others for fine tuning of the result.
 
You must define:
*''image:'' image filename
*''headertext:'' text in the header
*''maintext:'' text in the main body
 
You should probably define:
*''bordercolor:'' color of the border
*''headerbackground:'' color of the header
*''headercolor:'' color of the header text
 
The defaults are:
*''margintopbottom:'' auto
*''margintopbottom:'' auto
*''marginleftright:'' inherit
*''marginleftright:'' 0
*''borderwidth:'' 2px
*''borderwidth:'' 2px
*''borderstyle:'' solid
*''borderstyle:'' solid
*''bordercolor:'' black
*''bordercolor:'' black
*''width:'' 250px
*''width:'' 250px
*''padding:'' auto
*''padding:'' 0
*''background:'' auto
*''background:'' white
*''fontsize:'' auto
*''fontsize:'' medium
*''imagepadding:'' auto
*''imagepadding:'' 0
*''imagewidth:'' 60px
*''imagewidth:'' 60px
*''headerbackground:'' black
*''headerbackground:'' black
*''headercolor:'' white
*''headercolor:'' white
*''headerfontsize:'' 85%
*''headerfontsize:'' small
*''headerlineheight:'' 16px
*''headerlineheight:'' 1.5
*''headeralign:'' center
*''headeralign:'' center
*''headerheight:'' auto
*''headerheight:'' auto
*''mainfontsize:'' xx-small
*''mainfontsize:'' xx-small
*''mainalign:'' center
*''mainalign:'' center
*''mainlineheight:'' auto
*''mainlineheight:'' 2
*''mainbackground:'' auto
*''mainbackground:'' transparent
*''maincolor:'' auto
*''maincolor:'' black
*''mainpadding:'' auto
*''mainpadding:'' 0
 
This allows new users to easily create templates, and advanced users to exercise fine control over what the templates they create look like.


==Examples==
==Example==
To create
To create
{{UserTemplate|headertext='''My First Template'''|maintext=This is my first template!|image=Dead.gif}}
{{UserTemplate|headertext='''My First Template'''|maintext=This is my first template!|image=Dead.gif}}
just type
just type
{{Code|&#123;&#123;UserTemplate&#124;headertext&#61;&#39;&#39;&#39;My First Template&#39;&#39;&#39;&#124;maintext&#61;This is my first template!&#124;image&#61;Dead.gif&#125;&#125;}}
<nowiki>{{UserTemplate|headertext='''My First Template'''|maintext=This is my first template!|image=Dead.gif}}</nowiki>


[[Category:Utility Templates|{{PAGENAME}}]]
[[Category:Userboxes| {{PAGENAME}}]]</noinclude>
</noinclude>

Latest revision as of 19:56, 2 March 2010

Example.jpg {{{headertext}}}
{{{maintext}}}

Usage

{{UserTemplate
|margintopbottom=size
|marginleftright=size
|borderwidth=size
|borderstyle=style
|bordercolor=color
|width=size
|padding=size
|background=color
|fontsize=size
|imagepadding=size
|image=name
|imagewidth=size
|headerbackground=color
|headercolor=color
|headerfontsize=size
|headerlineheight=size
|headeralign=alignment
|headerheight=size
|headertext=text
|mainfontsize=size
|mainalign=alignment
|mainlineheight=size
|mainbackground=color
|maincolor=color
|mainpadding=size
|maintext=text
}}

This template is the mother of all user box templates. You need only define a few variables to get it to function. But you can adjust others for fine tuning of the result.

You must define:

  • image: image filename
  • headertext: text in the header
  • maintext: text in the main body

You should probably define:

  • bordercolor: color of the border
  • headerbackground: color of the header
  • headercolor: color of the header text

The defaults are:

  • margintopbottom: auto
  • marginleftright: 0
  • borderwidth: 2px
  • borderstyle: solid
  • bordercolor: black
  • width: 250px
  • padding: 0
  • background: white
  • fontsize: medium
  • imagepadding: 0
  • imagewidth: 60px
  • headerbackground: black
  • headercolor: white
  • headerfontsize: small
  • headerlineheight: 1.5
  • headeralign: center
  • headerheight: auto
  • mainfontsize: xx-small
  • mainalign: center
  • mainlineheight: 2
  • mainbackground: transparent
  • maincolor: black
  • mainpadding: 0

Example

To create

Dead.gif My First Template
This is my first template!

just type

{{UserTemplate|headertext='''My First Template'''|maintext=This is my first template!|image=Dead.gif}}