Documentação da predefinição[ver] [editar] [histórico] [purgar]

Utility template for constructing optional style attributes. This is probably only useful in other templates.

It allows to create a style with any number of rules, omitting any not given (or blank) and omitting the entire style attribute if none are given.

This means that this:

{{#if:{{{padding-top|}}}{{{padding-bottom|}}}|style="{{#if:{{{padding-top|}}}|padding-top:{{{padding-top}}};}}{{#if:{{{padding-bottom|}}}|padding-bottom:{{{padding-bottom}}};}}"}}

becomes:

{{optional style
 | padding-top = {{{padding-top|}}}
 | padding-bottom = {{{padding-bottom|}}}
}} 

Parameters:

  • Any given parameters are used as the CSS property name (e.g. padding-top). The parameter value is the property value (e.g. blank or 2em).
  • style: Pre-built CSS (i.e. like padding-left:2em; padding-right:1em; (the semicolons between items are important). Will be added at the end of the style, so it will override any other parameter (in this case, padding-left would be overridden by style.

Examples =

editar

Exemplo

* {{optional style
 | padding-top = 2em
 | padding-bottom =
}} 
  • style="padding-top:2em;"

Exemplo: All parameters blank

* {{optional style
 | padding-top =
 | padding-bottom =
}} 

Exemplo: With a style parameter

* {{optional style
 | padding-top = 4em;
 | padding-bottom =
 | style = padding-left:2em;padding-top:1em;
}} 
  • style="padding-top:4em;padding-left:2em;padding-top:1em;"