Difference between revisions of "Template:Warning"

From PINE64
Jump to navigation Jump to search
(Enhance Example)
(+1)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
<!--    -->
{{Template}}
{{Template}}


A waring box for highlighting dangerous actions and security warnings. It starts with "'''Warning:'''" by default.
A warning box for highlighting dangerous actions and to emphasize security warnings. It starts with "'''Warning:'''" by default.


== Usage ==
== Usage ==
Line 12: Line 11:


  <nowiki>{{Warning|This is a warning.}}</nowiki>
  <nowiki>{{Warning|This is a warning.}}</nowiki>
<!--      -->
 
{{Warning|This is a warning.}}
{{Warning|This is a warning.}}
<!--      -->
 
== Technical notes ==
== Technical notes ==
The boxes use <code>display: table</code> to support both adaptive width and floating siblings, all other alternatives can't archive them as perfect as this solution within just one HTML element. However, it has its own flaw, if you put it into another table, its padding will gone. Avoid putting hints, notes and warnings into any tables until solution was found, or we give up and use two elements for just one box.


This template uses class <code>.template-box</code> and <code>.template-warning</code>.
This template uses class <code>.template-box</code> and <code>.template-warning</code>.
Line 25: Line 26:
* [https://wiki.archlinux.org/title/Template:Warning ArchWiki: Template:Warning]: the template on which this one is based on
* [https://wiki.archlinux.org/title/Template:Warning ArchWiki: Template:Warning]: the template on which this one is based on
* [[Template:Hint]]
* [[Template:Hint]]
* [[Template:Info]]
* [[Template:Note]]
* [[Template:Note]]
<!--                  -->
</noinclude><includeonly><div role="note" class="template-box" style="
</noinclude><includeonly>
<!--                  -->
<div role="note" class="template-box template-warning" style="
display: table;
display: table;
min-width: 16em;
min-width: 16em;
Line 38: Line 37:
color: black;
color: black;
background-color: #fee7e6;
background-color: #fee7e6;
">{{{1|}}}</div>
"><strong>Warning:</strong> {{{1|}}}</div></includeonly>
<!--      -->
</includeonly>

Latest revision as of 09:21, 12 April 2022

This page is a template. Check out all pages using this template.
For more information, read Template:Template.

A warning box for highlighting dangerous actions and to emphasize security warnings. It starts with "Warning:" by default.

Usage

{{Warning|warning content}}

Example

{{Warning|This is a warning.}}
Warning: This is a warning.

Technical notes

The boxes use display: table to support both adaptive width and floating siblings, all other alternatives can't archive them as perfect as this solution within just one HTML element. However, it has its own flaw, if you put it into another table, its padding will gone. Avoid putting hints, notes and warnings into any tables until solution was found, or we give up and use two elements for just one box.

This template uses class .template-box and .template-warning. In the future, if the TemplateStyles Extension is installed on this MediaWiki instance, one may move the embedded inline styles to Template Style files.

See also