Anonymous user
Template:Float/doc: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 1:
{{Documentation subpage}}
<!--
== Description ==
For aligning text in general, see {{tl|align}}. For floating images, boxes, and other elements, see {{tl|stack}}.
== Usage ==
These are the standard usage:
* <code><nowiki>{{float
* <code><nowiki>{{float
More configuration:
* <code><nowiki>{{float |width= |height= |top= |right= |bottom= |left= |</nowiki>{{bigger|{{smallcaps|item}}}}}}</code>
<code>{{bigger|{{smallcaps|item}}}}</code> is required. You must specify what text or element to float or it will throw an error.
All parameters are optional. The parameters {{para|width}} and {{para|height}} are to indicate the width/height of the <code><nowiki><div></nowiki></code> element. <!--Unnecessary?: Note that if any values other than zero for ''top'' and ''right'' are required, they need to be specified.-->
The optional parameters {{para|top}}, {{para|right}}, {{para|bottom}} and {{para|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, <code><nowiki>{{float |top=2.0em |left=2px |width=10em | the content to float}}</nowiki></code>.
=== 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|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) ===
{{Navbox
| name = Float/doc
Line 31 ⟶ 46:
* [[List of weapons of the Japanese Navy|Weapons]]
}}
{{Hidden begin |showhide=left |title=
<pre>
{{Navbox
Line 49 ⟶ 64:
{{Hidden end}}
=== Example 2 (with float) ===
{{Navbox
| name = Float/doc
Line 56 ⟶ 71:
| title = [[Imperial Japanese Navy]]
| listclass = hlist
| list1 = {{float
* [[Imperial Japanese Navy admirals|Admirals]]
* [[Battles of the Imperial Japanese Navy|Battles]]
Line 63 ⟶ 78:
* [[List of weapons of the Japanese Navy|Weapons]]
}}
{{Hidden begin |showhide=left |title=
<pre>
{{Navbox
Line 70 ⟶ 85:
| title = [[Imperial Japanese Navy]]
| listclass = hlist
| list1 = {{float
* [[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]]
}}
</pre>
{{Hidden end}}
=== Example 3 (with float and custom values) ===
We use {{tlf|float}} with a custom value of {{para|top}} this time:
{{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]]
}}
{{Hidden begin |showhide=left |title=The code used in the above example}}
<pre>
{{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]]
Line 81 ⟶ 127:
=== Alternatives for navigational boxes ===
{{Navbox
| name = Float/doc
Line 96 ⟶ 142:
* [[List of weapons of the Japanese Navy|Weapons]]
}}
{{Hidden begin |showhide=left |title=
<pre>
{{Navbox
Line 120 ⟶ 166:
* {{tl|clear}}
<includeonly>{{
<!-- Add categories below this line, and interwikis at Wikidata -->
[[{{ns:Category}}:Positioning templates]]
}}</includeonly>
|