Template:SiteNotice: Difference between revisions
(Adapted changes from Template:Notice but used in-line styles instead of templatestyles. In-line styles are necessary because templatestyles only works within .mw-parser-output, and sitenotice is outside that.) |
(Added explanation of how this template is technically different from Template:Notice.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly><div | <includeonly><div style="text-align: {{{text-align|left}}}; padding: .5em; margin: .5em 0; border-width: 1px 5px 1px 5px; border-style: solid; border-radius: 5px 5px 5px 5px; display: flex; flex-direction: row; column-gap: 1em; border-color: rgb({{#switch: {{{color|green}}} | green = 170, 220, 0 | teal = 47, 172, 172 | blue = 0, 153, 255 | orange = 255, 128, 0 | yellow = 235, 238, 61 | red = 217, 0, 0 | pink = 240, 60, 120 | maroon = 174, 21, 102 | gray = 201, 201, 201 | #default = 170, 220, 0 }});> | ||
{{#if: {{{file|}}} | <div>[[File:{{{file}}}|{{{filesize|48px}}}|link=]]</div> | }}<div style="flex-grow: 1;">{{#if: {{{header|}}}|<div style="font-weight: 600;">{{{header}}}</div> | }}<div style="font-size: 9pt;">{{{content|}}}</div></div></div></includeonly><noinclude> | {{#if: {{{file|}}} | <div style="display: flex; align-items: center;>[[File:{{{file}}}|{{{filesize|48px}}}|link=]]</div> | }}<div style="flex-grow: 1; display: flex; flex-direction: column; justify-content: center;">{{#if: {{{header|}}}|<div style="font-weight: 600;">{{{header}}}</div> | }}<div style="font-size: 9pt;">{{{content|}}}</div></div></div></includeonly><noinclude> | ||
Use this template to create notices on [[MediaWiki:Sitenotice]]. For non-sitenotice usage, please use [[Template:Notice]] or other [[:Category:Notice templates|notice templates]] instead. | Use this template to create notices on [[MediaWiki:Sitenotice]]. For non-sitenotice usage, please use [[Template:Notice]] or other [[:Category:Notice templates|notice templates]] instead. | ||
This template is intended to be almost identical to Template:Notice, with the exception that this template uses in-line CSS instead of a TemplateStyles CSS stylesheet. In-line CSS is necessary because TemplateStyles CSS only works within <code>.mw-parser-output</code>, and the sitenotice is outside of <code>.mw-parser-output</code>. | |||
== Usage == | == Usage == | ||
'''Syntax''': <code><nowiki>{{SiteNotice | '''Syntax''': <code><nowiki>{{SiteNotice|text-align=|border=|width=|file=|filesize=|header=|content=}}</nowiki></code> | ||
{| class="wikitable sitecolor-generic" | {| class="wikitable sitecolor-generic" |
Latest revision as of 17:20, 16 July 2023
Use this template to create notices on MediaWiki:Sitenotice. For non-sitenotice usage, please use Template:Notice or other notice templates instead.
This template is intended to be almost identical to Template:Notice, with the exception that this template uses in-line CSS instead of a TemplateStyles CSS stylesheet. In-line CSS is necessary because TemplateStyles CSS only works within .mw-parser-output
, and the sitenotice is outside of .mw-parser-output
.
Usage
Syntax: {{SiteNotice|text-align=|border=|width=|file=|filesize=|header=|content=}}
color
|
Named, optional | The color preset for the border. Options are green , blue , teal , orange , yellow , red , maroon , pink , and gray . Defaults to green .
| |||
text-align
|
Named, optional | The text-align attribute of the header and content text, e.g. center . Defaults to left .
| |||
file
|
Named, optional | The file to show on the left-hand section as a filename. e.g. Example.jpg . Defaults to nothing shown.
| |||
filesize
|
Named, optional | The file's size on the left-hand section. e.g. 30px . Defaults to 48px if a file was specified, otherwise none.
| |||
header
|
Named, optional | The header text. e.g. Notice . Defaults to nothing shown.
| |||
content
|
Named, optional | The content text. e.g. Test message . Defaults to nothing shown.
|
Examples
{{SiteNotice|file=Example.jpg|header=Under Construction|content=This article is under construction.}}
{{SiteNotice|file=Example.jpg|header=Notice with header text only.}}
{{SiteNotice|file=Example.jpg|content=Small notice without a header.}}
{{SiteNotice|file=Example.jpg|header=Green notice|color=green}}
{{SiteNotice|file=Example.jpg|header=Blue notice|color=blue}}
{{SiteNotice|file=Example.jpg|header=Teal notice|color=teal}}
{{SiteNotice|file=Example.jpg|header=Orange notice|color=orange}}
{{SiteNotice|file=Example.jpg|header=Yellow notice|color=yellow}}
{{SiteNotice|file=Example.jpg|header=Red notice|color=red}}
{{SiteNotice|file=Example.jpg|header=Maroon notice|color=maroon}}
{{SiteNotice|file=Example.jpg|header=Pink notice|color=pink}}
{{SiteNotice|file=Example.jpg|header=Gray notice|color=gray}}