Template:Float

From MozillaWiki
Jump to: navigation, search
{{{1}}}
Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

{{float}} encloses the entered text (or other element) in <div> tags, and floats the output to the left, or to the right (or not at all).

Parameters

There are 2 parameters, both unnamed, of which 1 is required and 1 is optional.

Syntax

The template's syntax is

  • {{float|custom text/element |float value }}

Required parameter

1

Custom text/element

The text (or other element) you wish to float. The parameter is unnamed, so no parameter name needs to be specified.

Note
  • This parameter must be placed before the 2nd parameter.
  • By default, if no 2nd parameter is specified, the template will float the entered text/element to the right.
Usage
  • {{float|1}}

Optional parameter

2

Float

Specifies the float you want to impose on the text/element in parameter |1. The parameter is unnamed, so no parameter name needs to be specified.

Available values
Value Comments Default value
none No margins
left Right margin: 20 px;
bottom margin: 10 px
right Left margin: 20 px;
bottom margin: 10 px
Green check.png
Notes
  • This parameter must be placed after the 1st parameter.
  • By default, this parameter will be set to the value right.
  • If an invalid value is entered, the template will display an error message.
Usage
  • {{float|1|2}}

Examples

Correct use

Element Float What you type What you see
Text None This text doesn't float|none}}
This text doesn't float
Left This text floats to the left|left}}
This text floats to the left
Right This text floats to the right|right}}
This text floats to the right
Image None [[File:Idea.png|20px|link=]]|none}}
Idea.png
Left [[File:Idea.png|20px|link=]]|left}}
Idea.png
Right [[File:Idea.png|20px|link=]]|right}}
Idea.png

Incorrect use

Float What you type What you see
Any other than
none,
left, or
right
This text will not be displayed|east}} Error in {{float}}: the float value "east" is invalid.

See also