模板:Legend/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索

显示一行图例,并带有颜色框。

用法[编辑]

{{legend|背景颜色|标签|outline=描边颜色|border=CSS边框}}
  • 背景颜色会传入颜色框的CSSbackground-color属性。
  • outline参数是可选的,表示框周边的边框的颜色。
  • border参数是可选的,会覆盖outline参数,并设置框周围显示的CSS边框(例如1px solid #aaa)。

示例[编辑]

{{legend|black|非洲}}
{{legend|green|美洲}}
{{legend|blue|大洋洲}}
{{legend|#ff0|歐洲}}
{{legend|#ff2800|亞洲}}
  非洲
  美洲
  大洋洲
  欧洲
  亚洲

完整参数列表[编辑]

{{legend
| 图例框的颜色
| 图例后跟随的文本
| outline   = 图例框周围的边框
| border    = 为边框指定自定义的CSS样式(覆盖outline)
| textcolor = “text”的颜色
| size      = “text”的文本大小
| text      = 图例框内的文本
}}

限制[编辑]

在参数|text=中使用特殊的字符可能会有未知的结果。例如,要在|text=中使用*,请使用|text={{asterisk}}。要在|text=中使用井号,请使用|text={{number sign}}

模板数据[编辑]

以下是该模板的模板数据,适用于可视化编辑器等工具。

Legend模板数据

<templatedata> { "params": { "1": { "label": "颜色", "description": "图例项的CSS颜色,以任何的CSS格式", "example": "\"#6D6E00\", \"#ffa\", \"yellow\"", "type": "line", "required": true }, "2": { "label": "标签文本", "description": "图例项的标签", "example": "\"soda\" is most common", "type": "string", "suggested": true }, "border": { "label": "CSS border样式", "description": "图例项的边框的CSS样式", "type": "string" }, "outline": { "label": "项描边", "description": "图例项的描边的CSS颜色", "example": "silver", "type": "line" }, "text": { "label": "项贩的文本", "description": "Text to be displayed in the legend entry box, i.e. within the color specified", "example": "Af", "type": "line" }, "textcolor": { "label": "文本颜色", "description": "CSS color of text inside the legend's colored box", "type": "string" }, "size": {

           "label": "大小",

"description": "Font size of the legend entry, including colored box", "type": "string" } }, "description": "显示一行图例,并带有颜色框。" } </templatedata>