Template:Clear/doc: Difference between revisions

From Pandora's Tale Wiki
Content added Content deleted
m (2 revisions imported)
 
No edit summary
Line 1: Line 1:
;Description
{{doc/start}}
This template allows you to clear the left side, right side, or both sides of the page. Clearing means that the content following the template will not be displayed until the existing content on the specified sides (for example, "hanging" or floating images or blocks) is displayed completely. This template is often used so that the text does not flow around unrelated images.


The template adds the following code to the page: <code><nowiki><div style="clear:left/right/both;"></div></nowiki></code> (the value after <code>clear</code> depends on the parameters). This code affects elements with the CSS property <code>float</code>, including files floated to the side (for example, <code><nowiki>[[File:Image.png|right]]</nowiki></code>).
This template allows you to clear the left side, the right side, or both by adding <code>&lt;div style="clear:left/right/both;"&gt;&lt;/div&gt;</code>


;Syntax
==Usage==
* To clear both sides of the page, add the code {{t|Clear}}.
{{tl|Clear}}: Makes content wait until existing content is completed in all columns. Often used to stop text from flowing next to unrelated images.
* To clear only the left side of the page, add the code {{t|Clear|left}}.
* To clear only the right side of the page, add the code {{t|Clear|right}}.


You can also use {{t|-}} instead of {{t|Clear}} as a shorthand call for this template.
To clear the left, simply put {{tlx|Clear|left}}. To clear the right, put {{tlx|Clear|right}}. To clear both sides, put {{tl|Clear}}.
__NOTOC__
;Example
<pre style="display:table">


=== Section 1 ===
This template can also be called with {{tl|-}} for short.
[[File:Example.jpg|200px|right]]
Section 1 text.


=== Section 2 ===
{{doc/end}}
Section 2 text.
{{Clear|right}}

=== Section 3 ===
Section 3 text.
</pre>

This code produces the following result:

----

=== Section 1 ===
[[File:Example.jpg|200px|right]]
Section 1 text.

=== Section 2 ===
Section 2 text.
{{Clear|right}}

=== Section 3 ===
Section 3 text.

----

As you can see above, the example image added in section 1 is displayed to the right and extends down through section 2, while the {{t|Clear}} template is called at the end of the second section, resulting in the example image not being next to section 3. Thus, one use of the {{t|Clear}} template is to control which elements are displayed next to which other elements.

== See also ==
* [https://developer.mozilla.org/en-US/docs/Web/CSS/clear CSS property <code>clear</code> on MDN]
* [https://developer.mozilla.org/en-US/docs/Web/CSS/float CSS property <code>float</code> on MDN]

<includeonly>[[Category:General wiki templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>

Revision as of 01:19, 4 September 2022

Description

This template allows you to clear the left side, right side, or both sides of the page. Clearing means that the content following the template will not be displayed until the existing content on the specified sides (for example, "hanging" or floating images or blocks) is displayed completely. This template is often used so that the text does not flow around unrelated images.

The template adds the following code to the page: <div style="clear:left/right/both;"></div> (the value after clear depends on the parameters). This code affects elements with the CSS property float, including files floated to the side (for example, [[File:Image.png|right]]).

Syntax
  • To clear both sides of the page, add the code {{Clear}}.
  • To clear only the left side of the page, add the code {{Clear|<left>}}.
  • To clear only the right side of the page, add the code {{Clear|<right>}}.

You can also use {{-}} instead of {{Clear}} as a shorthand call for this template.

Example

=== Section 1 ===
[[File:Example.jpg|200px|right]]
Section 1 text.

=== Section 2 ===
Section 2 text.
{{Clear|right}}

=== Section 3 ===
Section 3 text.

This code produces the following result:


Section 1

Section 1 text.

Section 2

Section 2 text.

Section 3

Section 3 text.


As you can see above, the example image added in section 1 is displayed to the right and extends down through section 2, while the {{Clear}} template is called at the end of the second section, resulting in the example image not being next to section 3. Thus, one use of the {{Clear}} template is to control which elements are displayed next to which other elements.

See also