Bản mẫu:Cảnh báo

Bách khoa toàn thư mở Wikipedia
(Đổi hướng từ Bản mẫu:Cảnh cáo)
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

This is the {{Cảnh báo}} message box. It should be used sparingly and only for significant information for which a more specific template doesn't exist. Less important comments should be put as regular text on the page's talk page instead.

Usage[sửa mã nguồn]

{{Cảnh báo|1=Place notice text here. |heading=Optional heading above the text}}

This box automatically changes its style depending on what kind of page it appears; see {{Mbox}} for details, and view the examples below for demonstrations.

Use in talk and userspace[sửa mã nguồn]

Outside "important" locations like mainspace, policy pages, and noticeboards, this message box can also be used on other pages in a more relaxed way, such as on the top of talk page alerts, wikiproject pages, userspace pages, etc. Talk and noticeboard cases should probably include your signature at the end of the template's main content.

Optional parameters[sửa mã nguồn]

The box can be titled with an optional |heading= (or |header= or |title=). This is left-aligned by default. This:
     {{Cảnh báo |heading=Heading |Lorem ipsum dolor sit amet...}} produces an all-left notice:

It can be hard to notice or read short heading and/or message on a wide monitor when they centered. For long content, it can be centered with |align=center.
[While |align=right is a valid value, it will only be useful when this template is ported to right-to-left language Wikipedias, and shouldn't be used on English Wikipedia or it will be difficult to read.]
This:
     {{Cảnh báo |heading=Heading |align=center |Lorem ipsum dolor sit amet...}} produces:

A shorthand parameter to center the heading and main text at the same time is |center=y. This:
     {{Cảnh báo |heading=Heading |center=y |Lorem ipsum dolor sit amet...}} produces:

The parameter |textstyle= can be used to pass arbitrary inline CSS to the main note content. For example, one could center small-caps text below a left-aligned heading; this:
     {{Cảnh báo |heading=Heading |textstyle=text-align:center; font-variant:small-caps; |Lorem ipsum dolor sit amet...}} produces:

Similarly, the parameter |headstyle= can be used to pass arbitrary inline CSS to the heading content. For example, one could center a red heading above a left-aligned message; this:
     {{Cảnh báo |heading=Heading |headstyle=text-align:center; color:red; |Lorem ipsum dolor sit amet...}} produces:


The message box can also take an |image= parameter (with a value of just the bare filename of the image, without File:..., Image:..., or markup), but this is discouraged in articles. For an example of its use, see below.

See #Talk pages, below for the talkpage-only |small=y parameter. See also #Adding an image, shortcuts, etc., on the righthand side for additional parameters that work in talk and project pages but not articles.

Articles[sửa mã nguồn]

{{Cảnh báo |Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}} produces:

Talk pages[sửa mã nguồn]

On talk pages, {{Cảnh báo |Lorem ipsum dolor sit amet...}} produces:

You may also set the talkpage-only parameter |small=yes, which alters the template's appearance thus:

{{Cảnh báo |small=yes |header=Header |style=text-align:center; |Lorem ipsum dolor sit amet...}} produces ......

Setting the |image= parameter changes the image shown on the lefthand side of the template.

{{Cảnh báo |image=Stop hand nuvola.svg |heading=Heading |Lorem ipsum dolor sit amet...}} produces:

(Note the effect of omitting |style=text-align:center; here)

File and category pages[sửa mã nguồn]

{{Cảnh báo |Lorem ipsum dolor sit amet...}} on a File: page would produce... ... and, on a Category: page, would produce:

Other pages[sửa mã nguồn]

On other pages, such as those in the User:, Wikipedia: and Help: namespaces, {{Cảnh báo |Lorem ipsum dolor sit amet...}} would produce:

External links and equals signs[sửa mã nguồn]

In most cases, external links can be used in the template without any complications. If a link – or any text – contains one or more equals signs (" = "), however, everything before the first sign will be interpreted as the name of a parameter. To prevent this, name the text carrying the link as the first numbered parameter:

{{Cảnh báo |1=Any text/links including "=" should now be interpreted correctly.}} produces:

Adding an image, shortcuts, etc., on the righthand side[sửa mã nguồn]

To add shortcuts, images, other templates, etc. to the righthand side of the template, use |imageright=. This does not work in articles. For example,
{{Cảnh báo |imageright=[[File:Wiki letter w.svg|40px]] |Lorem ipsum dolor sit amet...}} produces:

{{Cảnh báo |imageright={{Shortcuts|You|Me}} |Lorem ipsum dolor sit amet...}} includes the {{Shortcut}}s template providing links to You and Me:

Alternate shortcut option[sửa mã nguồn]

As an alternative to imageright, the |shortcut= (or |shortcut1=) and |shortcutN= parameters (where N = 2 to 5) may be used to display shortcuts. For instance, {{Cảnh báo |shortcut1=Me |shortcut2=You |shortcut3=Them |shortcut4=Us |shortcut5=Everyone |Lorem ipsum dolor sit amet...}} produces:

Note: If both imageright and any of the shorcut parameters are used, the contents of imageright will override the shortcut/s. For example,
{{Cảnh báo |imageright=[[File:Wiki letter w.svg|40px]] |shortcut1=Me |shortcut2=You |shortcut3=Them |shortcut4=Us |shortcut5=Everyone |Lorem ipsum dolor sit amet...}} produces: