模板:Message box/doc:修订间差异
外观
清空全部内容 标签:清空 |
无编辑摘要 标签:手工回退 |
||
| 第1行: | 第1行: | ||
该模板使用了模板样式 [[Template:Message box/styles.css]] 。 | |||
== 描述 == | |||
用于在页面中显示一个简洁的提示消息框,支持自定义标题、文本、图标、颜色等样式。 | |||
== 参数 == | |||
{| class="wikitable" | |||
! 参数 !! 说明 !! 类型 !! 默认值 | |||
|- | |||
| <code>title</code> || 消息框的标题(可选) || 文本 || 无 | |||
|- | |||
| <code>text</code> 或 <code>1</code> || 消息框的正文内容。若未提供 <code>text</code>,则使用第一个未命名参数 || 文本 || 必填 | |||
|- | |||
| <code>image</code> || 图标文件名(不含 <code>File:</code> 前缀),如 <code>Info.svg</code> || 文件名 || 无 | |||
|- | |||
| <code>image-size</code> || 图标尺寸,可带单位(如 <code>px</code>、<code>em</code>) || 字符串 || <code>40px</code> | |||
|- | |||
| <code>bg</code> || 消息框背景色(颜色名、十六进制、RGB 等) || 颜色值 || <code>#eef</code> | |||
|- | |||
| <code>border</code> || 左侧高亮条的颜色 || 颜色值 || <code>#44f</code> | |||
|- | |||
| <code>class</code> || 为消息框容器添加额外的 CSS 类 || 字符串 || 无 | |||
|- | |||
| <code>style</code> || 直接添加内联样式,优先级高于预设样式 || CSS 声明 || 无 | |||
|} | |||
== 示例 == | |||
=== 基本用法 === | |||
<pre>{{Message box|这里是消息正文。}}</pre> | |||
{{Message box|这里是消息正文。}} | |||
=== 带标题 === | |||
<pre>{{Message box | |||
| title = 提示 | |||
| text = 这是一条重要提示。 | |||
}}</pre> | |||
{{Message box | |||
| title = 提示 | |||
| text = 这是一条重要提示。 | |||
}} | |||
=== 添加图标 === | |||
<pre>{{Message box | |||
| title = 注意 | |||
| text = 请确认您的操作。 | |||
| image = Help.svg | |||
}}</pre> | |||
自定义图标大小: | |||
<pre>{{Message box | |||
| title = 小贴士 | |||
| text = 使用小尺寸图标。 | |||
| image = Lightbulb.png | |||
| image-size = 24px | |||
}}</pre> | |||
=== 自定义颜色 === | |||
<pre>{{Message box | |||
| title = 警告 | |||
| text = 该操作不可撤销。 | |||
| bg = #fee | |||
| border = #f44 | |||
| color = #f55 | |||
}}</pre> | |||
{{Message box | |||
| title = 警告 | |||
| text = 该操作不可撤销。 | |||
| bg = #fee | |||
| border = #f44 | |||
| color = #f55 | |||
}} | |||
=== 添加额外样式或类 === | |||
<pre>{{Message box | |||
| text = 这条消息更宽,且带有阴影。 | |||
| style = width: 90%; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); | |||
}}</pre> | |||
{{Message box | |||
| text = 这条消息更宽,且带有阴影。 | |||
| style = width: 90%; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); | |||
}} | |||
<pre>{{Message box | |||
| text = 自定义类示例。 | |||
| class = my-custom-class | |||
}}</pre> | |||
=== 完整示例 === | |||
<pre>{{Message box | |||
| title = 游戏版本更新 | |||
| text = 本次更新增加了新的生物群系和合成配方。 | |||
| image = Compass.png | |||
| image-size = 48px | |||
| bg = #eef5e8 | |||
| border = #5a8 | |||
}}</pre> | |||
模板文档引用自[[模板:Message box/doc]] | |||
<includeonly> | |||
[[Category:页面模板]] | |||
</includeonly> | |||
<noinclude> | |||
[[Category:文档页面]] | |||
</noinclude> | |||
2026年10月9日 (五) 06:49的版本
该模板使用了模板样式 Template:Message box/styles.css 。
描述
用于在页面中显示一个简洁的提示消息框,支持自定义标题、文本、图标、颜色等样式。
参数
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
title |
消息框的标题(可选) | 文本 | 无 |
text 或 1 |
消息框的正文内容。若未提供 text,则使用第一个未命名参数 |
文本 | 必填 |
image |
图标文件名(不含 File: 前缀),如 Info.svg |
文件名 | 无 |
image-size |
图标尺寸,可带单位(如 px、em) |
字符串 | 40px
|
bg |
消息框背景色(颜色名、十六进制、RGB 等) | 颜色值 | #eef
|
border |
左侧高亮条的颜色 | 颜色值 | #44f
|
class |
为消息框容器添加额外的 CSS 类 | 字符串 | 无 |
style |
直接添加内联样式,优先级高于预设样式 | CSS 声明 | 无 |
示例
基本用法
{{Message box|这里是消息正文。}}
这里是消息正文。
带标题
{{Message box
| title = 提示
| text = 这是一条重要提示。
}}
提示
这是一条重要提示。
添加图标
{{Message box
| title = 注意
| text = 请确认您的操作。
| image = Help.svg
}}
自定义图标大小:
{{Message box
| title = 小贴士
| text = 使用小尺寸图标。
| image = Lightbulb.png
| image-size = 24px
}}
自定义颜色
{{Message box
| title = 警告
| text = 该操作不可撤销。
| bg = #fee
| border = #f44
| color = #f55
}}
警告
该操作不可撤销。
添加额外样式或类
{{Message box
| text = 这条消息更宽,且带有阴影。
| style = width: 90%; box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}}
这条消息更宽,且带有阴影。
{{Message box
| text = 自定义类示例。
| class = my-custom-class
}}
完整示例
{{Message box
| title = 游戏版本更新
| text = 本次更新增加了新的生物群系和合成配方。
| image = Compass.png
| image-size = 48px
| bg = #eef5e8
| border = #5a8
}}
模板文档引用自模板:Message box/doc