قالب:Optional style
المظهر
| هذا القالب يستعمل لوا: |
Usage
[عدل]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 or2em). - 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
[عدل]See also
[عدل]- {{HTML attribute}}