模板:Mbox/doc

維基教科書,自由的教學讀本

使用方法[編輯]

This is the {{mbox}} or message box meta-template.

It is used to build message box templates, using CSS classes to reskin it for specific namespaces. It offers several different colours, uses default images if no image parameter is given and it has some other features.

使用方法[編輯]

{{mbox
| type      = query (optional)
| image     = Emblem-question-yellow.svg (optional)
| style     = width:400px; color:red; font-weight:bold; font-style:italic; (optional)
| text      = The message body text.
}}


消息框類型[編輯]


Image message box types[編輯]

In the Image namespace, several additional options are available. It is recommended you still use {{imbox}} for these boxes in the meantime, as imbox uses different markup in line with other Ambox implementations and the image margins used on mbox are different.

其他圖片[編輯]

The default images shown above are mostly for convenience. In many cases it is more appropriate to use more specific images. These examples use the image parameter to specify an image other than the default images.

Special[編輯]

Some other parameter combinations.


Technical details[編輯]

This template uses CSS classes.

If you need to use special characters in the text parameter then you need to escape them like this:

{{mbox
| text  = <div>
Equal sign = and a start and end brace { } work fine as they are. 
But here is a pipe {{!}} and two end braces <nowiki>}}</nowiki>. 
And now a pipe and end braces <nowiki>|}}</nowiki>.
</div>
}}


Internally this meta-template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta-templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.