• Home
  • Random
  • Log in
  • Settings
  • About Safer nicotine wiki
  • Disclaimers
Safer nicotine wiki

Template:Float

  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]

Contents

  • 1 Description
  • 2 Usage
    • 2.1 Beware
  • 3 Examples
    • 3.1 Example 1 (without float)
    • 3.2 Example 2 (with float)
    • 3.3 Example 3 (with float and custom values)
    • 3.4 Alternatives for navigational boxes
  • 4 See also

Description

This template is used to position text or elements to the rightmost/leftmost of a page/area, without changing the alignment or formatting of other text and elements nearby.

Whatever you float with this template will cover up anything underneath it. Text will wrap underneath this template, not around it.

For aligning text in general, see {{align}}. For floating images, boxes, and other elements in a way that text wraps around instead of beneath, see {{stack}}.

Usage

These are the standard usage:

  • {{float|item}} floats item on the rightmost of a page/area.
  • {{float|left|item}} floats item on the leftmost of a page/area.

More configuration:

  • {{float |width= |height= |top= |right= |bottom= |left= |item}}

item is required. You must specify what text or element to float or it will throw an error.

All parameters are optional. The parameters |width= and |height= are to indicate the width/height of the <div> element.

The optional parameters |top=, |right=, |bottom= and |left= are to indicate how far from their respective positions the item is to be positioned.

Any established HTML/CSS units may be used, for example, {{float |top=2.0em |left=2px |width=10em | the content to float}}.

Beware

Beware when using this template in navboxes. Please ensure whatever it floats (e.g. an image) does not float over other elements or text, even after the navbox is resized.

To align centered lists in a navbox with an image, see the alternatives for navigational boxes section below.

Examples

Note how the links in the second two examples are centered relative to the whole template, unlike those in the first example.

Example 1 (without float)

This is a navbox using its image parameter:

  • v
  • t
  • e
Imperial Japanese Navy
  • Admirals
  • Battles
  • Ships
  • Aircraft
  • Weapons
Naval Ensign of Japan
The code used in the above example
{{Navbox
| name = Float/doc
| state = uncollapsed
| title = [[Imperial Japanese Navy]]
| listclass = hlist
| image = [[File:Naval Ensign of Japan.svg|24px|border|Naval Ensign of Japan]]
| list1 =
* [[Imperial Japanese Navy admirals|Admirals]]
* [[Battles of the Imperial Japanese Navy|Battles]]
* [[List of ships of the Japanese Navy|Ships]]
* [[List of aircraft of the Japanese Navy|Aircraft]]
* [[List of weapons of the Japanese Navy|Weapons]]
}}

Example 2 (with float)

We use {{float}} instead of the navbox's image parameter:

  • v
  • t
  • e
Imperial Japanese Navy
Naval Ensign of Japan
  • Admirals
  • Battles
  • Ships
  • Aircraft
  • Weapons
The code used in the above example
{{Navbox
| name = Float/doc
| state = uncollapsed
| title = [[Imperial Japanese Navy]]
| listclass = hlist
| list1 = {{float|[[File:Naval Ensign of Japan.svg|24px|border|Naval Ensign of Japan]]}}
* [[Imperial Japanese Navy admirals|Admirals]]
* [[Battles of the Imperial Japanese Navy|Battles]]
* [[List of ships of the Japanese Navy|Ships]]
* [[List of aircraft of the Japanese Navy|Aircraft]]
* [[List of weapons of the Japanese Navy|Weapons]]
}}

Example 3 (with float and custom values)

We use {{float}} with a custom value of |top= this time:

  • v
  • t
  • e
Imperial Japanese Navy
Naval Ensign of Japan
  • Admirals
  • Battles
  • Ships
  • Aircraft
  • Weapons
The code used in the above example
{{Navbox
| name = Float/doc
| state = uncollapsed
| title = [[Imperial Japanese Navy]]
| listclass = hlist
| list1 = {{float|top=0.5em|[[File:Naval Ensign of Japan.svg|24px|border|Naval Ensign of Japan]]}}
* [[Imperial Japanese Navy admirals|Admirals]]
* [[Battles of the Imperial Japanese Navy|Battles]]
* [[List of ships of the Japanese Navy|Ships]]
* [[List of aircraft of the Japanese Navy|Aircraft]]
* [[List of weapons of the Japanese Navy|Weapons]]
}}

Alternatives for navigational boxes

We use its image parameter and liststyle with padding-left set to the image width:

  • v
  • t
  • e
Imperial Japanese Navy
  • Admirals
  • Battles
  • Ships
  • Aircraft
  • Weapons
Naval Ensign of Japan
The code used in the above example
{{Navbox
| name      = Float/doc
| state     = uncollapsed
| title     = [[Imperial Japanese Navy]]
| listclass = hlist
| image     = [[File:Naval Ensign of Japan.svg|24px|border|Naval Ensign of Japan]]
| liststyle = padding-left: 24px
| list1     =
* [[Imperial Japanese Navy admirals|Admirals]]
* [[Battles of the Imperial Japanese Navy|Battles]]
* [[List of ships of the Japanese Navy|Ships]]
* [[List of aircraft of the Japanese Navy|Aircraft]]
* [[List of weapons of the Japanese Navy|Weapons]]
}}

See also

  • {{align}}
  • {{clear}}
  • {{float begin}} and {{float end}} - Places wikicode in an image frame. Allows captions. Handles wikitables without having to use escape characters.
  • {{stack}}
The above documentation is transcluded from Template:Float/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://safernicotine.wiki/mediawiki/index.php?title=Template:Float&oldid=22231"
Last edited on 4 November 2025, at 18:48
Cookies help us deliver our services. By using our services, you agree to our use of cookies.
More information

Languages

      This page is not available in other languages.

      Safer nicotine wiki
      • Creative Commons Attribution-ShareAlike
      • Powered by MediaWiki
      • Monitored by WikiApiary
      • ipv6 ready
      • Powered by Semantic MediaWiki
      • This page was last modified on 4 November 2025, at 18:48. Warning: Page may not contain recent updates.
      • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
      • Privacy policy
      • About Safer nicotine wiki
      • Disclaimers
      • Terms of Use
      • Desktop
      • Data access
      • Developers
      • Statistics
      • Cookie statement