Template:Float: Difference between revisions

Want an adless experience? Log in or Create an account.
(Created page with "<onlyinclude><div style="{{#switch: {{{1|}}} | left = float: left; margin-right: {{{pad|1em}}}; | right = float: right; margin-left: {{{pad|1em}}}; | center = text-align: cent...")
 
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<onlyinclude><div style="{{#switch: {{{1|}}}
<onlyinclude>{{#switch: {{lc:{{{1|}}}}}
| left = float: left; margin-right: {{{pad|1em}}};
| left = <div style="float: left; margin-right: {{{pad|1em}}}; {{{style|}}}">
| right = float: right; margin-left: {{{pad|1em}}};
| right = <div style="float: right; margin-left: {{{pad|1em}}}; {{{style|}}}">
| center = text-align: center; margin: auto;
| center = <div style="text-align: center; margin: auto; {{{style|}}}">
| end = </div>
| end = </div>
}} {{{style|}}}">{{#if: {{{2|}}}|{{{2}}}</div>|}}</onlyinclude>
}}{{#if: {{{2|}}}|{{{2}}}</div>|}}</onlyinclude>


==Purpose==
==Purpose==

Latest revision as of 17:02, September 9, 2024


Purpose

This template slightly simplifies floating sections of wikitext to one side of the page. It also allows a more intuitive way of centering.

Usage

{{Float| side | content }}

  • side — Which direction to float. Valid values are left, right, and center.
  • content — The content to be floated. (Optional.)

Sometimes it is inconvenient to pass the content as a parameter, such as when it includes pipe characters ( | ) or equal signs ( = ). In these cases, omit the "content" parameter and place the content directly after and outside of the {{Float| side }} template, followed by {{Float| end }}.

To push text below the floated block, see {{Clear}}.

Some additional styling options are available:

{{Float| side | pad= | style= | content }}

  • pad — How much space between the floated block and the surrounding content. Must include a unit such as 'em' or 'px'. (Optional. Default: 1em)
  • style — Hook for additional style control. (Optional.)