Template talk:Col-2

Latest comment: 6 months ago by Marchjuly in topic Using with multi-level bulleted lists

Example:

{{col-begin}}
{{col-2}}

== See also ==
* [[General Motors streetcar conspiracy]]
* [[List of light-rail transit systems]]
* [[Light rail]]

{{col-2}}

== External links ==
* http://www.zeljeznice.net/galerija/categories.php?cat_id=89 - Pictures of trams in Croatia (HR)
{{col-end}}

gives:

Wikipedia:tutorial

edit

This code makes the last page of the tutorial fit within a square screen:

{| style="width:95%"
|-
| 
Left column             
|
Right column                                      
|}

That this works implys that 50% does not take into account the border, and therefore probably should be 47% instead --Chuck Marean 17:04, 13 October 2006 (UTC)Reply

Edit request

edit

{{editprotected}}
Please replace

{{Col-begin/doc}}

by

{{template|Col-begin/doc}}

16@r 22:09, 19 October 2007 (UTC)Reply

 Y Done, but I changed it to {{template doc|Col-begin/doc}} instead, since it appears that that was your intent given the other editprotected requests you made. :) Nihiltres(t.l) 14:15, 20 October 2007 (UTC)Reply

{{editprotected}}
Hello. It would be better to changed the above code into:

{{template doc|Template:Col-begin/doc}}

And then move the page Col-begin/doc to Template:Col-begin/doc. Greetings --Tlustulimu (talk) 14:20, 11 January 2008 (UTC)Reply

Is the line break in ></p> | width= creating extra space? If so, this needs to be removed.174.3.121.27 (talk) 03:52, 31 May 2010 (UTC)Reply

interwiki

edit

{{editprotected}}

Disabling. Interwiki links on the templates go on the /doc page, which is not protected. The Russian link at least is already present. Chris Cunningham (user:thumperward: not at work) - talk 14:57, 19 August 2010 (UTC)Reply

Use CSS

edit

Could someone update this template to use CSS instead of deprecated presentational attributes? Helder 13:13, 3 November 2012 (UTC)Reply

  Done see here. Strictly speaking, these three attributes are obsolete (align=; valign=; width=) in HTML 5, not deprecated: the difference is that browser writers are under no obligation to support obsolete features, but should support deprecated features for the time being, for backward compatibility. All three were valid in HTML 4, but only width= was marked as deprecated. --Redrose64 (talk) 15:05, 3 November 2012 (UTC)Reply

Extra <p> tag?

edit

Is that tag really needed? It seems this is removed by Tidy (and maybe it breaks if Tidy is disabled). Helder 13:13, 3 November 2012 (UTC)Reply

I was wondering what its purpose is. Not knowing, I've left it alone. --Redrose64 (talk) 15:05, 3 November 2012 (UTC)Reply
FYI: Long note follows, but just in case anyone is interested.

The extra <p> causes some unintentional behavior today. It invalidates the last attribute in the preceding wikitable code.
This affects a common invocation of {{col-begin}}{{col-2}} where the style attribute in {{col-begin}} is not shown.[1]

Here's a simple example you can test in Sandbox:
{{col-begin}}{{col-2}}a{{col-end}}
View the HTML. Note that the <table> says role="presentation" but does not have a style attribute
Now try this: (note the whitespace) between {{col-begin}} and {{col-2}}
{{col-begin}} {{col-2}}a{{col-end}}
View the HTML. Note that the <table> says role="presentation" and has a style attribute

The reason for the difference is because Template:Col-begin ends with a style attribute
When {{col-2}} is appended, the following string is generated:
style="border-collapse..."<p></p>
This text is treated by the Xml Attribute parser in Sanitizer.php as an invalid attribute (It stops at the whitespace, not the close quote)
As a result, the parser strips the entire style attribute.

I'm going to guess that the <p> tag was put in to force a new line for the next line's "| style="width:50%; ". This would have occurred while MediaWiki was putting in code to automatically prepend "\n" to any template that starts with "|", "*", etc..[2]
This makes the <p> tag unnecessary to its original purpose, though removing it today, would cause pages to render worse.
For example, Supreme Court of the United States#See also would have a large gap between "See also" and the first list. This gap would be introduced by the currently suppressed style: "border-collapse: collapse;". You can test it by adding/removing a space with the following:
==See also==
{{Portal|Supreme Court of the United States|Government of the United States|Law}}
{{col-begin}}{{col-2}}
* a
{{col-2}}
* b
{{col-end}}
Hope this is useful to someone. gnosygnu 18:47, 5 April 2014 (UTC)Reply
  1. ^ The relevant text of Template:Col-begin is as follows:
    {| class="{{{class|}}} multicol" role="presentation" style="border-collapse: collapse; padding: 0; border: 0; background:{{{bgColor|transparent}}}; width:{{{width|100%}}};"
  2. ^ From Parser.php (also, see bugzilla)
    # Bug 529: if the template begins with a table or block-level
    # element, it should be treated as beginning a new line.
    # This behavior is somewhat controversial.
    $text = "\n" . $text;

Template-protected edit request on 1 August 2018

edit

Use of <p></p> generates a Lint Error .

Code should be replaced with something like:

<!-- Blank line for table handling -->
| style="width:50%; text-align:{{{align|left}}}; vertical-align:{{{valign|top}}};" |<noinclude>
{{documentation}}
</noinclude>
<!-- Write your request ABOVE this line and do not remove the tildes and curly brackets below. -->
}} ~~~~

ShakespeareFan00 (talk) 10:37, 1 August 2018 (UTC)Reply

  Not done: please make your requested changes to the template's sandbox first; see WP:TESTCASES. See my comment at Template talk:Col-break. I'm guessing the same applies here. StevenJ81 (talk) 16:56, 1 August 2018 (UTC)Reply
edit

I have a doubt regarding the doc file of this template. Please check whether the inter language links present on the doc file needs to be removed from the doc file and added to wikidata or not. Adithyak1997 (talk) 06:20, 2 October 2018 (UTC)Reply

Using with multi-level bulleted lists

edit

Is there a proper way to use this template with multi-level bulleted lists that avoids any of the WP:LISTGAP problems discussed at Talk:2024 in combat sports#Bullet list formatting issues. I tried a fix here that seems to help mitigate the problem, but might not be the best way to approach this. -- Marchjuly (talk) 00:40, 7 May 2024 (UTC)Reply