跳转到内容

模板:Colored box/doc

来自天灾之下:危险连接资料站

This template is for community pages

模板参数

此模板首选参数换行的代码块格式。

参数描述类型状态
background-content-colorbackground-content-color

无描述

未知可选
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.

单行文本可选
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.

单行文本可选
background-title-colorbackground-title-color

无描述

未知可选
iconicon

无描述

文件可选
Title texttitle

无描述

字符串必需
Title linktitle-link

Turn title area into a clickable link

页面名称可选
title-colortitle-color

无描述

字符串可选
view-linkview-link link

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

页面名称可选
view-extlinkview-extlink link2

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

URL可选
view-textview-text

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

字符串可选
link-colorlink-color

无描述

未知可选
Contentcontent

无描述

内容必需

Examples

Example: Title

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

CONTENT

TITLE

CONTENT

{{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
}}

Example: Compare code

{{ContentGrid
|content=
  {{Colored box
    |title=Good example
    |style="border-color:var(--border-color-success);"
    |icon=OOjs UI icon check-constructive.svg
    |content=<syntaxhighlight lang="wikitext">
<!-- semantic infobox class added per [[:mw:Recommendations_for_mobile_friendly_articles]] for mobile compatibility -->
<div class="my-infobox-like-component infobox"></div>
{{Infobox}}
&lt;/syntaxhighlight>
  }}
  {{Colored box
    |title=''' Bad example '''
    |style="border-color:var(--border-color-destructive);"
    |icon=OOjs UI icon close-ltr-destructive.svg
    |content=<syntaxhighlight lang="wikitext">
<div class="my-infobox-like-component"></div>
&lt;/syntaxhighlight>
   }}
}}
文件:OOjs UI icon check-constructive.svg Good example
<!-- semantic infobox class added per [[:mw:Recommendations_for_mobile_friendly_articles]] for mobile compatibility -->
<div class="my-infobox-like-component infobox"></div>
{{Infobox}}
文件:OOjs UI icon close-ltr-destructive.svg Bad example
<div class="my-infobox-like-component"></div>

See also