Template:CssPre/Doc

From HorizonXI Wiki
< Template:CssPre
Revision as of 04:58, 14 February 2023 by Garnet-HorizonXI (Fandom) (talk | contribs) (Created page with "<noinclude>{{Tocright}} * ''This is the documentation for {{Tl| {{BASEPAGENAME}}}}. It is transcluded into the template page.'' </noinclude><onlyinclude> ==Usage== ===Syntax=== <code style="font-size:1.2em;"><nowiki>{{CssPre|<width>|<font-size>|<pad-size>|tag=<element>|b=<value>|t=<value>|custom=<style>|content=<value>}}</nowiki></code> {{CssPre|t=y | content = <nowiki>CssPre|<width>|<font-size>|<pad-size>|tag=<element>|b=<value>|t=<value> | custom = <style> | con...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • 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)
  • Unnamed Parameters
  1. 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.
  2. font-size: The value for the font-size (measured in em). Default value is 1.2
  3. 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
  1. Width = 50%
  2. Font = 1.5
  3. 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}}