Template:CssPre/Doc
From HorizonXI Wiki
- This is the documentation for {{ CssPre}}. It is transcluded into the template page.
Usage
Syntax
{{CssPre|<width>|<font-size>|<pad-size>|tag=<element>|b=<value>|t=<value>|custom=<style>|content=<value>}}
{{CssPre|<width>|<font-size>|<pad-size>|tag=<element>|b=<value>|t=<value> | custom = <style> | content = <value> }}
Parameters
All parameters are optional.
- Named Parameters
- tag: The name of the HTML element to be rendered.
Default value is pre. - b: Set to n to indicate that the element is not a block-level element, such as tag=code.
By doing so, the display, white-space and word-wrap styles will be suppressed. - t: Set to y to indicate that the content is a template.
By doing so, leading and trailing braces will be output. - custom: Any custom CSS you want to be included in the style attribute.
Each style must be properly formatted:<name>:<value>;
- content: Anything that should appear within the element.
When providing Wikitext that should not be interpreted, surrounded the content with <nowiki></nowiki> tags. (see example)
- tag: The name of the HTML element to be rendered.
- Unnamed Parameters
- width: The value for the width. Default value is 80%
The value is used exactly as it is provided.
To prevent this parameter from being used, set it to 0.
This should be done for inline elements such as tag=code. - font-size: The value for the font-size (measured in em). Default value is 1.2
- pad-size: The value for the padding (measured in em). Default value is 1
Examples
No Style
- Standard PRE block without a style attribute.
<pre> {{MyTemplate | parm1 = | parm2 = }} </pre>
Output:
{{MyTemplate | parm1 = | parm2 = }}
With CssPre
- Basic example with only the t and content parameters provided.
{{CssPre|t=y | content = <nowiki>MyTemplate | parm1 = | parm2 = </nowiki> }}
Output:
{{MyTemplate | parm1 = | parm2 = }}
Custom CSS
- Changes the font color to blue using custom.
{{CssPre|t=y|custom=color:blue; | content = <nowiki>MyTemplate | parm1 = | parm2 = </nowiki> }}
Output:
{{MyTemplate | parm1 = | parm2 = }}
Sizes
- Custom size overrides
- Width = 50%
- Font = 1.5
- Padding = 2
{{CssPre|50%|1.5|2|t=y | content = <nowiki>MyTemplate | parm1 = | parm2 = </nowiki> }}
Output:
{{MyTemplate | parm1 = | parm2 = }}
Inline Element
- A
CODE
element.
{{CssPre|tag=code|b=n|t=y|0||0.1 | content = <nowiki>SimpleTemplate|parm1|parm2</nowiki> }}
Output:
{{SimpleTemplate|parm1|parm2}}