Difference between revisions of "Template:BMI"
Jump to navigation
Jump to search
imported>EvergreenFir (updating colors per WP:COLOR by lightening darker orange and making font white for the dark red.) |
imported>WOSlinker (add class="error") |
||
| Line 5: | Line 5: | ||
|style="color:{{{{{|safesubst:}}}BMI/font|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}{{;}} background:{{{{{|safesubst:}}}BMI/color|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}" {{{{{|safesubst:}}}!}} | |style="color:{{{{{|safesubst:}}}BMI/font|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}{{;}} background:{{{{{|safesubst:}}}BMI/color|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}" {{{{{|safesubst:}}}!}} | ||
}}{{{{{|safesubst:}}}BMI/pad|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}| | }}{{{{{|safesubst:}}}BMI/pad|{{{{{|safesubst:}}}#expr:(({{{lb|{{{lbs|0}}}}}}*0.45359237 + {{{kg|0}}})/((0.0254*({{{in|0}}} + 12* {{{ft|0}}}) + {{{m|0}}} + 0.01* {{{cm|0}}})^2)) round 1}}}}| | ||
| − | <span style="color:red">Error: Specify weight in <nowiki>{{{kg}}}</nowiki> or <nowiki>{{{lb}}}</nowiki></span>}}| | + | <span class="error" style="color:red">Error: Specify weight in <nowiki>{{{kg}}}</nowiki> or <nowiki>{{{lb}}}</nowiki></span>}}| |
| − | <span style="color:red">Error: Specify height in <nowiki>{{{m}}}</nowiki>, <nowiki>{{{cm}}}</nowiki>, <nowiki>{{{ft}}}</nowiki>, or <nowiki>{{{in}}}</nowiki></span> | + | <span class="error" style="color:red">Error: Specify height in <nowiki>{{{m}}}</nowiki>, <nowiki>{{{cm}}}</nowiki>, <nowiki>{{{ft}}}</nowiki>, or <nowiki>{{{in}}}</nowiki></span> |
}}|{{tl|BMI}} | }}|{{tl|BMI}} | ||
}}<noinclude> | }}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
Latest revision as of 20:22, 24 November 2019
{{BMI}}
This template calculates a person's body mass index using their height and weight.
Usage
The person's height and weight must both be specified.
The weight can be specified using either of the following units:
kg=kilogramslb=pounds
The height can be specified using one (or more) of the following units:
m=metrescm=centimetresft=feetin=inches
Examples
| Code | Result |
|---|---|
{{BMI|m = 1.82|kg = 56}}
|
16.9 |
{{BMI|cm = 182|kg = 81}}
|
24.5 |
{{BMI|ft = 6|lb = 200}}
|
27.1 |
{{BMI|in = 72|lb = 250}}
|
33.9 |
{{BMI|ft = 6|in = 1|lb = 275}}
|
36.3 |
{{BMI|m = 1.62|lb = 250}}
|
43.2 |
Optional table coloring
| Code | Result |
|---|---|
{{BMI|m = 1.82|kg = 56|color=y}}
|
16.9 |
{{BMI|cm = 182|kg = 81|color=y}}
|
24.5 |
{{BMI|ft = 6|lb = 200|color=y}}
|
27.1 |
{{BMI|in = 72|lb = 250|color=y}}
|
33.9 |
{{BMI|ft = 6|in = 1|lb = 275|color=y}}
|
36.3 |
{{BMI|m = 1.62|lb = 250|color=y}}
|
43.2 |
See also
- {{convert}}
| The above documentation is transcluded from Template:BMI/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |