Template:Float box

From Body Communication
Revision as of 06:20, 9 August 2021 by SadanYagci (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
{{{1}}}
Template documentation[view] [edit] [history] [purge]

The Template:Float_box floats the contents of parameter {1} as a box along the right-side boxes on a page, such as alongside the left edge of an infobox or image, aligned to the same level as nearby images.

Usage:  {{float_box|text here}}
{{float_box|{{Portal}} }}
{{float_box|{{Commons category|xxxx}} }}
{{float_box|'''Link Boxes'''|margins=0px 20px 6px 0}}

Some of the various link-boxes might have an option "align=float" to use instead, but otherwise, this template can be used. A group of link-boxes can be floated by listing all of them as parameter {1}. As follows:

Infobox
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
{{float_box|{{Commons category|xxxx}}{{Portal|Animals}}{{Portal|Birds}} }}

The floated box area will allow other text to wrap (to the left side), rather than blocking the fill/wrap of text below that point. Note, however, that the floated area will be as wide as the widest box within, so that text wrapped outside the area cannot fill any whitespace gaps inside the float_box area.

Multiple use of Float_box will cause each to float beside the others, in reverse order, right-to-left, across the page, such as the 3 instances:  {{float_box|'''XX'''}}{{float_box| '''YY'''}}{{float_box|'''ZZ'''}}:
XX
 YY
ZZ

Each box will float, left-ward, across the page. There is no limit to the number of multiple floatboxes used, and they will wrap to additional lines, so that all can fit across and down the page.

Parameters

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for Float box

<templatedata> { "params": { "1": { "label": "Content", "description": "The content to float", "type": "content", "required": true }, "cellspacing": { "label": "Cell spacing", "description": "The cell spacing to apply to the table on which this template is based. Try margins instead.", "default": "1", "deprecated": "Depreciated in HTML 5, consider margins instead." }, "margins": { "label": "Margins", "description": "The margins to apply, in the order top, right, bottom, left. Search \"CSS margins\" for details.", "example": "0 0 0.5em 1em", "default": "Zero margins." }, "style": { "label": "Additional style", "description": "Additional CSS to apply." } },

"description": "The template
ERROR: Missing parameter 1 in Float_box.
floats the contents of parameter 1 as a box along the right-side boxes on a page, such as alongside the left edge of an infobox or image, aligned to the same level as nearby images."

} </templatedata>

Examples

Some other examples are:

Link Boxes
{{float_box|'''Link Boxes'''|margins=0px 20px 6px 0}}

Float_box can also be used to float 1 or more images across a page.

Mona Lisa, by Leonardo da Vinci, from C2RMF retouched.jpg
Mona Lisa, by Leonardo da Vinci, from C2RMF retouched.jpg
{{float_box|[[Image:Mona Lisa, by Leonardo da Vinci, from C2RMF retouched.jpg|30px]]}}{{float_box|[[Image:Mona Lisa, by Leonardo da Vinci, from C2RMF retouched.jpg|30px]]}}

It might take some experience to learn how the box area floats, in combination with various images or WP:Wikitables on a page. The operation of Template:Float_box is very quick, using the <table> feature of the HTML markup language.

Float_box to float portal boxes

Because auto-floating of portal boxes could cause a loss of margin control, the Template:Float_box can be used, as needed in some articles, when floating a portal box would look better alongside an infobox (or right-side image).

Infobox


Line 1
Line 2
Line 3
Line 4
L5
L6
L7
L8
L9

Test

A wikitable here, as a typical left-side table. The overlap on left-side tables had been a frequent problem with allowing other boxes to "float:right" on a page. So this is a test of how well a floating portal-box would avoid overlapping onto a left-side table.

The example here uses {Float_box} to float 2 portal boxes (for Animals & Cats), as follows:

  • {{Float_box |{{Portal|Animals}}{{Portal|Cats}} }}

The 2 portal-boxes are stacked together, and floated together as a stack, by both being listed in parameter 1 to {Float_box}. Although the 2 portal-boxes were specified below the Mona Lisa image, because the infobox+image were also stacked together, then the {Float_box} moved the 2 portal-boxes, even higher, alongside the infobox.
Normally, a portal-box would be stuck below the Mona Lisa image, causing this entire text section to format further below, and causing a large text-gap of empty whitespace to appear near the infobox. There is no limit to the number of portalboxes (or Commonscat boxes) which can be listed within a {Float_box} call, such as in a stub or an article with many stacked images near the bottom. Using {Float_box} is extremely efficient, due to being a short template which uses builtin tag <table> to float the boxes.

See also

  • {{Image frame}} – displays any content in a standard image frame.
  • {{Fake image}} – to show an empty image box where an image would fit.