• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Divbox

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 453,000 pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This template should not be substituted.
CSSThis template uses TemplateStyles:
  • Template:Divbox/styles.css

This template can be used to create simple, flexible coloured text background.

Please note that this is intended to be a decorative template and not for use on the general encyclopedia. It will not display on articles.

Contents

  • 1 Purpose
  • 2 Usage
    • 2.1 Parameters
    • 2.2 Examples
  • 3 Making new divbox styles
  • 4 See also

Purpose

Wikipedia abounds in boxed templates, such as:

  • {{delete}}
  • {{tfd}}
  • {{GFDL}}
  • {{current}}
  • {{FAC}}

Boxes may not always be appropriate; they can be obtrusive. But when boxes are used, they are generally formatted ad hoc. This leads to inconsistencies.

{{Divbox}} provides a straightforward method of presenting any text within a box. Colors are selected using a private style keyword, which sets both box border and background, already chosen to work together, in a visual sense.

The keyword none puts your content inside an invisible box. This is available to offer the identical box model for your content, without a visible box.

This template may be used within another template; or as part of another page.

Usage

Template general syntax is as follows:

{{divbox|1=style|2=title|3=content|radius=}}

Parameters

1 (Style)
Mandatory. Use any of the following:
amber
black
bloodred
blue
brown
forest
gold
gray
green
navy
none
orange
plain
purple
lilac
red
white
yellow
fawn
tt
simar
greenv
grayh
email
double
wordperfect
ivory
lavender
You can forgo "1=", as long as this is the first unnamed parameter in the list.
2 (Title)
Optional. Plain text; appears strong and centered at top. You can forgo "2=", as long as this is the second unnamed parameter in the list.
3 (Content)
Mandatory. Any text, including markup, that is to form the body of the message. You can forgo "3=", as long as this is the third unnamed parameter in the list, and the content does not contain an equals sign (=).
radius
Radius of the rounded edges, along with a valid unit, such as px, pt or em. The parameter works on styles that innately have both sharp or round edges, overriding their default edge roundness. You can forgo this entire parameter and its value; but if used, you cannot omit "radius=", which is case sensitive. However, like any named parameter, it may appear in any position (i.e. it does not need to be the last parameter).

Examples

What you see What you type
gray:
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|gray|Lorem ipsum|Lorem ipsum dolor...}}
red:
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|radius=5px|red|Lorem ipsum|Lorem ipsum dolor...}}
navy:
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|radius=10px|navy|Lorem ipsum|Lorem ipsum dolor...}}
amber:
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|radius=15px|amber|Lorem ipsum|Lorem ipsum dolor...}}
Without a border or background:
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|none|Lorem ipsum|Lorem ipsum dolor...}}
Without title
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|navy||Lorem ipsum dolor...}}
Content contains '=':
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
{{divbox|lavender|Lorem ipsum|3=Lorem <span style="color:#F00;">ipsum</span> dolor...}}

Making new divbox styles

I'd rather hope you were able to find joy within the existing set of styles, but if not, you can create new ones. Follow these instructions to be sure your new style will "play nice" with {{divbox}}. Note that this requires some understanding of CSS.

  1. Experiment in a drawing program, such as GraphicConverter or Adobe Photoshop, and decide what colors you want for your new box style. You need to find out the HTML color codes for each color.
  2. Open Template:Divbox/styles.css
  3. Copy an existing box style, such as .divbox-red
  4. Paste the new style at the bottom. It must be named .divbox-XXXXX, where "XXXXX" is your new style name.
  5. Replace the color codes with your new, chosen colors. Save the new page.
  6. Return to this Talk page and add your new style to this documentation. Remember, a job's not over until the paperwork is done!

Note that you may even change the division box margins and paddings. This is not recommended. There are a couple of good reasons for specifying these values, and in these units. Most users who "roll their own" make choices with unintended consequences; {{divbox}} is meant to help you avoid these pitfalls.

See also

  • {{divhide}}
  • view
  • edit
There are seven metatemplates in the Module:Message box family:
  • {{Ambox}}, for messageboxes on article pages.
  • {{Cmbox}}, for messageboxes on category pages.
  • {{Imbox}}, for messageboxes on file (image) pages.
  • {{Tmbox}}, for messageboxes on talk pages.
  • {{Fmbox}}, for header and footer messageboxes.
  • {{Ombox}}, for messageboxes on other types of page.
  • {{Mbox}}, for messageboxes that are used in different namespaces and change their presentation accordingly.

Closely related metatemplates:

  • {{Article stub box}}, for messageboxes in article stubs.
  • {{Dmbox}}, for messageboxes on disambiguation or set-index pages.
  • {{Ivmbox}}, a simple full-width box with default ivory background intended to frame important messages or notices.
  • {{Hmbox}}
The above documentation is transcluded from Template:Divbox/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Divbox&oldid=1312801828"
Last edited on 22 September 2025, at 18:00

Languages

    • العربية
    • বাংলা
    • भोजपुरी
    • Chi-Chewa
    • Dansk
    • الدارجة
    • فارسی
    • Føroyskt
    • 贛語
    • ગુજરાતી
    • 한국어
    • Hausa
    • हिन्दी
    • Bahasa Indonesia
    • Jawa
    • ಕನ್ನಡ
    • Македонски
    • Māori
    • मराठी
    • مصرى
    • Bahasa Melayu
    • नेपाली
    • 日本語
    • ଓଡ଼ିଆ
    • ਪੰਜਾਬੀ
    • ပအိုဝ်ႏဘာႏသာႏ
    • پښتو
    • ភាសាខ្មែរ
    • Português
    • Русский
    • संस्कृतम्
    • Shqip
    • සිංහල
    • Simple English
    • Slovenščina
    • Soomaaliga
    • کوردی
    • Српски / srpski
    • தமிழ்
    • Татарча / tatarça
    • တႆး
    • తెలుగు
    • ไทย
    • Тоҷикӣ
    • Українська
    • اردو
    • Tiếng Việt
    • 粵語
    • Zazaki
    • 中文
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 22 September 2025, at 18:00 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Legal & safety contacts
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop