Template:Colored box: Difference between revisions

From Wikitech
Content deleted Content added
mNo edit summary
No edit summary
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<div class="mw-tpl-colorbox {{{class|}}}" style="
<div style="box-shadow: 0 0 0.2em #999999; border-radius: 0.2em; margin: 0.5em 0.5em 1em 0.5em; background: {{{background-content-color|#fff}}}; {{{style|}}};">
<!-- CSS for icon and background -->
{{#if: {{{background-content-color|}}}
| background-color: {{{background-content-color|#fff}}};
<div style="background: {{{background-title-color|#eaecf0}}}; border-radius: 0.2em 0.2em 0 0; padding: 0.5em 1em 0.5em 1em;">{{#if:{{{icon|}}}|<span style="opacity: 0.8;">[[File:{{{icon}}}|20px|link=|alt=]]</span>&#32;}}<span style="color: {{{title-color|#000000}}}; font-weight: bold;">{{{title}}}</span><!--
}}
-->{{#if:{{{link|}}}|<div style="float: right; font-size: 0.7em;">[[{{{link}}}|<span style="color: {{{link-color|{{{title-color|#000000}}}}}};">{{{view-text|view}}}</span>]]</div>}}
{{{style|}}}
"><templatestyles src="Colored box/style.css"/><!--
--><div class="mw-tpl-colorbox-title {{#if: {{{title-link|}}} | mw-tpl-colorbox-title--linked }}" style="
{{#if: {{{background-title-color|}}}
| background-color: {{{background-title-color|#eaecf0}}};
}}
{{#if: {{{title-color|}}} | color: {{{title-color|#000000}}}; }}"
">{{#if: {{{icon|}}} | [[File:{{{icon}}}|20px|class=mw-tpl-colorbox-title-icon|link={{{title-link|}}}|alt=]]&#32; }}<!--
-->{{#if: {{{title-link|}}} | [[{{{title-link|}}}|<strong>{{{title}}}</strong>]] | <strong>{{{title}}}</strong> }}<!--
-->{{#if: {{{view-link|{{{link|}}}}}}
|<div class="mw-tpl-colorbox-title-corner">[[{{{view-link|{{{link|}}}}}}|<span style="{{#if: {{{link-color|{{{title-color|}}}}}} | color: {{{link-color|{{{title-color|}}}}}}; }}">{{{view-text|view}}}</span>]]</div>
|{{#if: {{{view-extlink|{{{link2|}}}}}}
|<div class="mw-tpl-colorbox-title-corner">[{{{view-extlink|{{{link2|}}}}}} <span style="{{#if: {{{link-color|{{{title-color|}}}}}} | color: {{{link-color|{{{title-color|}}}}}}; }}">{{{view-text|view}}}</span>]</div>
}}
}}
</div><!--
--><div class="mw-tpl-colorbox-content">
{{{content}}}
</div>
</div>
<!-- CSS for the content -->
<div style="padding: 0.5em 1em 0.5em 1em; border-radius: 0 0 0.2em 0.2em;">
{{{content}}}{{clr}}</div>
</div><noinclude>
</div><noinclude>
{{documentation}}
{{documentation}}
[[Category:Templates]]
</noinclude>
</noinclude>

Latest revision as of 14:51, 11 September 2023

{{{title}}}

{{{content}}}

Template documentation

This template is for community pages

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
background-content-colorbackground-content-color

no description

Unknownoptional
extra classesclass

Extra CSS classes to apply to the outermost box (space-separated). This is mainly for other templates using TemplateStyles so that they can scope their CSS to the box, but it may be useful in other cases as well.

Lineoptional
extra stylesstyle

Extra inline CSS rules to apply to the outermost element. Prefer TemplateStyles and using CSS classes if possible when using this template in another template.

Lineoptional
background-title-colorbackground-title-color

no description

Unknownoptional
iconicon

no description

Fileoptional
Title texttitle

no description

Stringrequired
Title linktitle-link

Turn title area into a clickable link

Page nameoptional
title-colortitle-color

no description

Stringoptional
view-linkview-link link

Create a "view" corner link to a given page.

Page nameoptional
view-extlinkview-extlink link2

Create a "view" corner link to a external URL. This cannot be used together with "view-link".

URLoptional
view-textview-text

Replace link text for "view-link" with something other than "view".

Stringoptional
link-colorlink-color

no description

Unknownoptional
Contentcontent

no description

Contentrequired

Examples

Example: Title

{{Colored box|title=TITLE|content=CONTENT}}
{{Colored box
|title=TITLE
|title-link=MediaWiki
|content=CONTENT
}}
TITLE

CONTENT

CONTENT

Example: View link

{{Colored box|title=TITLE|view-link=MediaWiki|content=CONTENT}}
{{Colored box|title=TITLE|view-link=MediaWiki|view-text=HELLO|content=CONTENT}}
{{Colored box|title=TITLE|view-extlink=https://mediawiki.org|view-text=HELLO|content=CONTENT}}
TITLE

CONTENT

TITLE

CONTENT

TITLE

CONTENT

Example: Everything

Icon, title link, custom view-link text

{{Colored box
|icon=OOjs_UI_icon_download-progressive.svg
|title=TITLE
|title-link=MediaWiki
|view-link=MediaWiki
|view-text=HELLO
|content=CONTENT
}}

{{{content}}}

See also