Difference between revisions of "Template:Flowlist/doc"

From blackwiki
Jump to navigation Jump to search
imported>Cedar101
m (→‎Examples: <source lang="moin">)
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
+
{{When on basepage|{{Uses TemplateStyles|Template:Flowlist/styles.css}}}}
 
===Usage===
 
===Usage===
 
If you have this problem of list bullets and numbers overlapping with a left floating image or Infobox, for example:
 
If you have this problem of list bullets and numbers overlapping with a left floating image or Infobox, for example:
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
 
* [[cat]]
 
* [[cat]]
 
* [[dog]]
 
* [[dog]]
Line 14: Line 14:
  
 
then {{tl|Flowlist}} enables lists to stay clear of these left floating objects. It effectively makes lists act as a block level element. It does however have a few [[#Side_effects|side effects]] that you should take note of.
 
then {{tl|Flowlist}} enables lists to stay clear of these left floating objects. It effectively makes lists act as a block level element. It does however have a few [[#Side_effects|side effects]] that you should take note of.
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
 
{{flowlist}}
 
{{flowlist}}
 
* [[cat]]
 
* [[cat]]
Line 27: Line 27:
  
 
===Examples===
 
===Examples===
<source lang="moin">
+
<pre><nowiki>
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
{{flowlist |
+
{{flowlist |
* [[cat]]
+
* [[cat]]
* [[dog]]
+
* [[dog]]
* [[horse]]
+
* [[horse]]
* [[cow]]
+
* [[cow]]
* [[sheep]]
+
* [[sheep]]
* [[pig]]
+
* [[pig]]
}}
+
}}
</source>
+
</nowiki></pre>
  
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
 
{{flowlist |
 
{{flowlist |
 
* [[cat]]
 
* [[cat]]
Line 51: Line 51:
  
 
;Alternative syntax:
 
;Alternative syntax:
<source lang="moin">
+
<pre><nowiki>
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
{{flowlist}}
+
{{flowlist}}
* [[cat]]
+
* [[cat]]
* [[dog]]
+
* [[dog]]
* [[horse]]
+
* [[horse]]
* [[cow]]
+
* [[cow]]
* [[sheep]]
+
* [[sheep]]
* [[pig]]
+
* [[pig]]
{{endflowlist}}
+
{{endflowlist}}
</source>
+
</nowiki></pre>
  
[[File:Example.png|left|thumb|100px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
 
{{flowlist}}
 
{{flowlist}}
 
* [[cat]]
 
* [[cat]]
Line 83: Line 83:
 
<div style="width:30em; display:inline-block; vertical-align:top; border: 1px dotted; padding: 1em; margin-right:2em; ">
 
<div style="width:30em; display:inline-block; vertical-align:top; border: 1px dotted; padding: 1em; margin-right:2em; ">
 
====This====
 
====This====
[[File:Example.png|left|thumb|20px|Test image]][[File:Example.png|right|thumb|20px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|20px|Test image]][[File:Bad Title Example.png|right|thumb|20px|Test image]] List of animals:
 
* [[cat]] in a very long sentence that should collide with the image to the right
 
* [[cat]] in a very long sentence that should collide with the image to the right
 
* [[dog]] in a very long sentence that should collide with the image to the right
 
* [[dog]] in a very long sentence that should collide with the image to the right
 
</div><div style="width:30em; display:inline-block; vertical-align:top; border: 1px dotted; padding: 1em;">
 
</div><div style="width:30em; display:inline-block; vertical-align:top; border: 1px dotted; padding: 1em;">
 
====Will become====
 
====Will become====
[[File:Example.png|left|thumb|20px|Test image]][[File:Example.png|right|thumb|20px|Test image]] List of animals:
+
[[File:Bad Title Example.png|left|thumb|20px|Test image]][[File:Bad Title Example.png|right|thumb|20px|Test image]] List of animals:
 
{{flowlist}}
 
{{flowlist}}
 
* [[cat]] in a very long sentence that should collide with the image to the right
 
* [[cat]] in a very long sentence that should collide with the image to the right
Line 99: Line 99:
 
* {{tl|flatlist}}
 
* {{tl|flatlist}}
 
* {{tl|plainlist}}
 
* {{tl|plainlist}}
 +
* [[MediaWiki_talk:Common.css/Archive_14#Lists_and_left_floating_images|The history of this template]]
 +
* [[phab:T13782|Phabricator ticket]]
 +
 +
{{HTML lists}}
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
+
<includeonly>{{Sandbox other||
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:List formatting and function templates|Flowlist]]
 
[[Category:List formatting and function templates|Flowlist]]
  
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 04:54, 25 April 2020

Usage

If you have this problem of list bullets and numbers overlapping with a left floating image or Infobox, for example:

Test image

List of animals:

then {{Flowlist}} enables lists to stay clear of these left floating objects. It effectively makes lists act as a block level element. It does however have a few side effects that you should take note of.

Test image

List of animals:

This template can be used with or without {{endflowlist}}.

Examples

[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
{{flowlist |
* [[cat]]
* [[dog]]
* [[horse]]
* [[cow]]
* [[sheep]]
* [[pig]]
}}
Test image

List of animals:

Alternative syntax
[[File:Bad Title Example.png|left|thumb|100px|Test image]] List of animals:
{{flowlist}}
* [[cat]]
* [[dog]]
* [[horse]]
* [[cow]]
* [[sheep]]
* [[pig]]
{{endflowlist}}
Test image

List of animals:

Parameters

  • class – adds a CSS class to the containing div.
  • style – adds CSS style options. Complex styles should not be used in articles (per wp:deviations) but may be acceptable on user, project, and talk pages.
Example: |style=border:solid 1px silver; background:lightyellow

Side effects

Using this technique has a side effect. If your list is longer than the floated element, then the list will not flow around the image like normal, but instead be one block, leaving white space below the floated element. This goes for both left and right side of the list.

This

Test image
Test image
List of animals:
  • cat in a very long sentence that should collide with the image to the right
  • dog in a very long sentence that should collide with the image to the right

Will become

Test image
Test image
List of animals:
  • cat in a very long sentence that should collide with the image to the right
  • dog in a very long sentence that should collide with the image to the right

See also