Clear – Template

From Bohemia Interactive Community
Revision as of 00:57, 4 March 2024 by Lou Montana (talk | contribs) (Add side option + examples using doc template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Adds an invisible HTML object to clear CSS float style.

Code:

<div style="clear:{{#switch:{{{1|}}}|left=left|right=|right|=both}}"></div>

This template is used on these pages.

Usage

{{Clear|alignment}}

  • alignment: (Optional, default both) float clearing; can be left, right or both.
Examples
Code Result
<div style="float: left; background-color: #5F5">LEFT</div>
<div style="float: right; background-color: #F55; height: 3em">RIGHT</div>

<div style="background-color: #FD5">Cleared</div>
<div style="float: left; background-color: #5F5">LEFT</div>
<div style="float: right; background-color: #F55; height: 3em">RIGHT</div>
{{Clear}}
<div style="background-color: #FD5">Cleared</div>
LEFT
RIGHT
Cleared


LEFT
RIGHT
Cleared
<div style="float: left; background-color: #5F5">LEFT</div>
<div style="float: right; background-color: #F55; height: 3em">RIGHT</div>
{{Clear|ohhimark}}
<div style="background-color: #FD5">Cleared</div>
LEFT
RIGHT
Cleared
<div style="float: left; background-color: #5F5">LEFT</div>
<div style="float: right; background-color: #F55; height: 3em">RIGHT</div>
{{Clear|both}}
<div style="background-color: #FD5">Cleared</div>
LEFT
RIGHT
Cleared
<div style="float: left; background-color: #5F5">LEFT</div>
<div style="float: right; background-color: #F55; height: 3em">RIGHT</div>
{{Clear|left}}
<div style="background-color: #FD5">Cleared</div>
LEFT
RIGHT
Cleared
<div style="float: left; background-color: #5F5; height: 3em">LEFT</div>
<div style="float: right; background-color: #F55">RIGHT</div>
{{Clear|right}}
<div style="background-color: #FD5">Cleared</div>
LEFT
RIGHT
Cleared