Difference between revisions of "Template:Clear/doc"

m (Text replacement - "<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>" to "{{Documentation subpage}}")
m (Updating)
 
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
+
<!-- Please add categories to the /doc subpage, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
__NOTOC__
+
{{Nosubst|The markup provided will be confusing to many editors, and as this template provides documentation for itself, there is little justification for substitution.}}
==Purpose==
+
{{#ifeq:{{FULLPAGENAME}}|Template:Clear|{{Template shortcut|-||Clr}}}}
This template is meant for visual design. It will separate all content before and after the template so any "floating" content, such as images, will not overflow to the next section.
+
 
 +
== Description ==
 +
This template makes content wait until existing content is completed in all columns. It is often used to prevent text from flowing next to unrelated images.
  
 
== Usage ==
 
== Usage ==
Add the following in the edit page:
+
* {{tlx|clear}} — adds <code>&lt;div style="clear:both;"&gt;&lt;/div&gt;</code>
<pre>{{clear}}</pre>
+
* {{tlx|clear|left}} — adds <code>&lt;div style="clear:left;"&gt;&lt;/div&gt;</code>
 +
* {{tlx|clear|right}} — adds <code>&lt;div style="clear:right;"&gt;&lt;/div&gt;</code>
 +
For technical details, see [[Template talk:Clear|the discussion in the talk page]].
 +
 
 +
== Examples ==
 +
 
 +
<div style="border: 1px solid black; background: #fde; padding: 1em; margin: 2em;">
 +
=== Example without {{tlf|clear}} ===
 +
[[File:Example.jpg|200px|left]]
 +
{{Lorem ipsum}}
  
==Example==
+
==== New section without the template before ====
<pre>
+
Without the code {{tlc|clear}}, this section starts at the right of the image.
==== Category 1 ====
 
[[File: Example.jpg|thumb|Example image]]
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  
 
 
{{clear}}
 
{{clear}}
 +
</div>
 +
<div style="border: 1px solid black; background: #fde; padding: 1em; margin: 2em;">
  
==== Category 2 ====
+
=== Example that uses {{tlf|clear}} ===
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
[[File:Example.jpg|200px|left]]
</pre>
+
{{Lorem ipsum}}<br/>
 
+
'''{{tnull|clear}}'''
Will display:
 
==== Category 1 ====
 
[[File: Example.jpg|thumb|Example image]]
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
 
{{clear}}
 
{{clear}}
  
==== Category 2 ====
+
==== New section with the template before ====
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.  
+
Here the code {{tlc|clear}} is placed before this section, so it appears below the image.
 +
</div>
  
==Example Without the Template==
+
== TemplateData ==
==== Category 1 ====
+
{{TemplateData header}}
[[File: Example.jpg|thumb|Example image]]
+
<templatedata>{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
"description": "Makes content wait until existing content is completed in all columns. Often used to stop text from flowing next to unrelated images, so text will appear on a full width line under the image.",
 +
"params": {
 +
"1": {
 +
"label": "Side",
 +
"description": "Can be 'right' or 'left' so content is delayed until just the right or left column is complete. The default clears both columns.",
 +
"type": "line",
 +
"required": false
 +
 +
}
 +
},
 +
"format": "inline"
 +
}</templatedata>
  
==== Category 2 ====
+
== See also ==
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
* {{tl|Clear left}} (implemented using this template)
 +
* {{tl|Clear right}} (implemented using this template)
 +
* {{tl|Clear2}} (derived from this template)
 +
* {{tl|Break}}
 +
* {{tl|Float}}
 +
* {{tl|Stack}}
  
<includeonly>
+
<includeonly>{{sandbox other||
<!-- ADD CATEGORIES BELOW THIS LINE -->
+
<!-- Add categories below this line, and interwikis at Wikidata -->
[[Category:Page Information templates|{{PAGENAME}}]]
+
[[Category:Line-handling templates]]
[[Category:Templates|{{PAGENAME}}]]
+
[[Category:XHTML tag-replacing templates]]
 +
}}</includeonly>

Latest revision as of 09:16, 7 October 2023


Description[edit]

This template makes content wait until existing content is completed in all columns. It is often used to prevent text from flowing next to unrelated images.

Usage[edit]

  • {{clear}} — adds <div style="clear:both;"></div>
  • {{clear|left}} — adds <div style="clear:left;"></div>
  • {{clear|right}} — adds <div style="clear:right;"></div>

For technical details, see the discussion in the talk page.

Examples[edit]

Example without {{clear}}[edit]

Example.jpg

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

New section without the template before[edit]

Without the code {{clear}}, this section starts at the right of the image.

Example that uses {{clear}}[edit]

Example.jpg

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


{{clear}}

New section with the template before[edit]

Here the code {{clear}} is placed before this section, so it appears below the image.

TemplateData[edit]

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools.

TemplateData for Clear

Makes content wait until existing content is completed in all columns. Often used to stop text from flowing next to unrelated images, so text will appear on a full width line under the image.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Side1

Can be 'right' or 'left' so content is delayed until just the right or left column is complete. The default clears both columns.

Lineoptional

See also[edit]