Nominations and Campaigning for the 2022 RationalWiki Moderator Election are now closed.

# Template:Messagebox1

 [purge] Documentation

This template is used on a large number of pages.

In order to prevent unnecessary server load, edits should be kept to a minimum. Please experiment in the template's /sandbox or /testcases subpage, or in your own sandbox, and consider discussing your changes on the talk page before applying them.

 Editing a template causes all pages that use the template to be re-rendered. If the template is used often, this can put a lot of load on the server since it fills up the job queue.

### Parameters

The first unnamed parameter will determine the icon displayed and give the table a class.

parameter icon class resulting style
warning mb-warning-orange
warning-orange mb-warning-orange
warning-red mb-warning-red
info mb-info
question mb-question
error mb-error
stop mb-stop
copyleft mb-copyleft

You can replace the default icon with something else using the image parameter, e.g.:

`{{messagebox1|warning|image = File.svg| {{lorem ipsum}} }}`

produces:

 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Alternatively, the first parameter can be arbitrary wikicode, e.g. a math tag, or an image of any size:

```{{messagebox1
|class=mb-centered m1
|1=[itex]3x-5y=6[/itex]
[itex]2x+4y=2[/itex]

[itex]x=?[/itex]
[itex]y=?[/itex]
|2=This article/section deals with mathematical concepts appropriate for a student in mid to late high school.
}}
```

produces:

 ${\displaystyle 3x-5y=6}$ ${\displaystyle 2x+4y=2}$ ${\displaystyle x=?}$ ${\displaystyle y=?}$ This article/section deals with mathematical concepts appropriate for a student in mid to late high school.
```{{messagebox1
|class=mb-centered
|[[File:Human.gif|200px]]
|This user is an idiot.
}}
```

produces:

 This user is an idiot.

It can also be omitted entirely, in which case no icon will be displayed.

See the Icons category for more icons.

The second unnamed parameter will be the contents of the messagebox.

The class parameter can be used to add one or more css classes to the box. For example, mb-fullwidth will make the box 100% wide instead of 80%.

Multiple classes should be separated by whitespace.

class resulting style
mb-fullwidth
mb-centered
mb-autowidth
mb-nomargin mb-autowidth
mb-brainwatermark-light
mb-brainwatermark-dark

### Nesting

You can use a messagebox within the text part of a messagebox. The nested messagebox will automatically be shrinked, its borders will be removed and a separator line will be added above.

Info text
 warning text

### Styling

The class parameter can be used to add a class specific to one template, to change the style of that one template. For example, Template:Mothball uses the class mothball to change the background color.

To avoid name clashes use the mb prefix for messagebox class names.

To style the messagebox using a class, use the css selector .messagebox.classname. For example, the background of Template:Mothball is changed by the following code [1]:

```.messagebox.mothball {
background-color: #FFC;
}
```

To style the table cells (both the image and the text):

```table.messagebox.classname td {
background-color: red;
}
```

The table cells also have classes that allow you to style them separately, these are mb-image and mb-text. The following example changes the background color of the image to green and the font color of the text to blue:

```table.messagebox.classname td.mb-image {
background-color:green;
}

table.messagebox.classname td.mb-text {
color:blue;
}
```

Note that since the purpose of this template is to give message boxes a consistent look, per-template styling should be kept to a minimum.