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

Template:Decimal cell

  • Template
  • Talk
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]

This template simulates decimal-alignment for a table cell by splitting a decimal number to place integer and fractional portions into two separate cells and minimizing the space between those cells. See Help:Table#Decimal point alignment for more information.

Usage

edit

This template requires a single un-named parameter: the value to format.

An optional named |style=CSS string parameter can be used to pass a CSS style string to apply to the cell or the text in it. The semicolon at the end of this string is optional. NB: do not quote this string (FIXME!). You can use wiki-markup or HTML tags to format the text, but you must separately format the integer and decimal parts independently and there is no way to format the decimal-point itself using these methods.

Examples

edit
Wiki source Rendered result
{| class="wikitable sortable"
! Example #
! colspan=2 | Aligned
! Plain
|-
| 1
| {{decimal cell|10}}
| 10
|-
| 2
| {{decimal cell|12345}}
| 12345
|-
| 3
| {{decimal cell|.1234}}
| .1234
|-
| 4
| {{decimal cell|style=background:#ffffcc|10.}}
| style="background:#ffffcc" | 10.
|-
| 5
| {{decimal cell|style=text-decoration: underline|10.2}}
| style="text-decoration: underline" | 10.2
|-
| 6
| {{decimal cell|<u>1</u>.<u>2</u>345}}
| <u>1</u>.<u>2</u>345
|-
| 7
| colspan=2 | 123
| 123
|}
Example # Aligned Plain
1 10 10
2 12345 12345
3
.1234 .1234
4 10
. 10.
5 10
.2 10.2
6 1
.2345 1.2345
7 123 123

Other examples:

  • Help:Table#Decimal point alignment
  • List of countries by level of military equipment#List

See also

edit
  • Template:Decimal-align, similar template that uses <span> elements instead of separate cells, and can wrap wikitext (including multiple table cells).
The above documentation is transcluded from Template:Decimal cell/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Decimal_cell&oldid=815991870"
Last edited on 18 December 2017, at 15:03

Languages

    • বাংলা
    • فارسی
    • 한국어
    • हिन्दी
    • Simple English
    • Slovenščina
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 18 December 2017, at 15:03 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop