Template talk:Div col

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Specifying the maximum number of columns[edit]

Hello! I've read § Support for setting both width and count above, and I have a similar suggestion. How about making it possible to specify the maximum number of columns? With that parameter, it would be like "use the specified columns width, but don't split the content into more than x columns". That would be highly usable in "See also" sections with more than a few links, for example, in which a two-column compaction would be saving quite a lot of vertical space (which is premium on wide screens) in many articles, while it would prevent the not-so-pretty creation of, say, four short columns on large-resolution screens. Thoughts? — Dsimic (talk | contribs) 21:53, 2 March 2015 (UTC)

Specifying both count and width (in CSS) should result in count being used as the maximum number of columns. It may not work as expected in older browser that supported columns. I'll put it on my todo list. -- [[User:Edokter]] {{talk}} 07:57, 3 March 2015 (UTC)
Awesome, thank you very much! Thinking about the browser support, I'd say that it should be beneficial to implement new features even if they aren't fully supported in older browsers, of course if they don't break the rendering when interpreted by older browsers. By the way, a few hours after posting here, I saw an article containing a pretty large section with bulleted lists that would also really benefit from having this option available. — Dsimic (talk | contribs) 08:09, 3 March 2015 (UTC)
I've re-implemented this in the sandbox for testing, but still defaulting to 2 columns (for now). The only issue I came across is Opera 12 ignoring the count when both are used. -- [[User:Edokter]] {{talk}} 09:46, 19 April 2015 (UTC)
Sounds good, thank you! Hopefully it will soon hatch out of the sandbox. :) — Dsimic (talk | contribs) 10:00, 19 April 2015 (UTC)
Any updates on this, please? — Dsimic (talk | contribs) 10:18, 18 August 2015 (UTC)
Not happy with the code yet. -- [[User:Edokter]] {{talk}} 15:54, 18 August 2015 (UTC)
@Edokter: Any updates on this, please? — Dsimic (talk | contribs) 07:39, 7 October 2015 (UTC)
Sorry, new job takes too much time. Will get to it. -- [[User:Edokter]] {{talk}} 10:52, 7 October 2015 (UTC)

30em not working?[edit]


At The Martian (film), "30em" no longer appears to work in creating multiple columns of the "Production" section's crew list. I've temporarily changed the parameter to "2" but wanted to mention it here to put on others' radar. Erik (talk | contrib) (ping me) 14:48, 1 October 2015 (UTC)

You need to use {{Div col|colwidth=30em}} not {{Div col|30em}} --Redrose64 (talk) 15:15, 1 October 2015 (UTC)
Thanks! That worked. :) Erik (talk | contrib) (ping me) 15:23, 1 October 2015 (UTC)
You can also use {{Div col||30em}} (with an extra "pipe"). — Dsimic (talk | contribs) 15:44, 1 October 2015 (UTC)
Good to know! A fellow editor pointed that out as well. I went ahead with Redrose64's suggestion since it is more straightforward; the extra "pipe" isn't as clear of a parameter. Erik (talk | contrib) (ping me) 18:13, 1 October 2015 (UTC)
Div col parameters works slightly different from {{reflist}}. I do plan on making it support '30em' for the first parameter as well. -- [[User:Edokter]] {{talk}} 15:58, 1 October 2015 (UTC)
Look forward to it! Erik (talk | contrib) (ping me) 18:13, 1 October 2015 (UTC)


Hi. Why was cols= marked as deprecated on the template's page? That's an essential function, and it is in no way mutually exclusive with colwidth=. The page says that the two are exclusive, but that's just false. Common sense says they are both complementary and essential. We don't always want everything formatted to unlimited, automatic, arbitrary numbers of columns. It wouldn't make any sense to have 10x2 layout instead of 2x10, for example. Screens will only continue getting bigger, but it still stands as common sense at any size. That's just a basic page layout concept. The "deprecated" marking needs to be removed. Furthermore, div col is generally the best all-purpose column formatting template, and it needs to ultimately subsume some other redundant and generally inferior ones, and I thank everyone who has contributed to it. — Smuckola(talk) 15:49, 6 October 2015 (UTC)

Hello! Please see the § Specifying the maximum number of columns discussion above; IMHO, having that kind of functionality would be very useful. — Dsimic (talk | contribs) 07:37, 7 October 2015 (UTC)

I agree that cols should be restored. Debresser (talk) 23:02, 12 July 2016 (UTC)

Gutter width[edit]

I was about to replace a template:multicol with a div col but couldn't because the multicol specifies a gutter width. That's apparently so the lists won't cause a "clear" after some infoboxes on the right side of the page. This is at German Type IX submarine. Could/should "div col" take a gutter width option? Is there a better way to do this? Kendall-K1 (talk) 20:09, 23 December 2015 (UTC)

Use something like {{div col|style=margin-right:20px;}} --Redrose64 (talk) 13:55, 25 December 2015 (UTC)
That worked, thanks! I do think an explicit param, or documenting this usage, would help those of us who are not css experts and are trying to replace a multicol with gutter param. But I'll admit that's a pretty obscure use case. Kendall-K1 (talk) 14:45, 25 December 2015 (UTC)

colwidth not working properly?[edit]

See Cebu City. In Barangays, North and South should both be 24em. Why aren't they? Or at my wrong? Mary McAllen (talk) 09:28, 6 April 2016 (UTC)

They both have minimum width of 24em. But North has images from the section above to deal with, so there is less overall space for the colunms. -- [[User:Edokter]] {{talk}} 11:00, 6 April 2016 (UTC)
Surely the point of |colwidth= is to fit all columns to keep the width the same, but use fewer columns if necessary. Shouldn't minimum be not used? Mary McAllen (talk) 13:40, 6 April 2016 (UTC)
In fact the two multicol divs are not used in the same margins contexts: there are floatting element in the right, that may extend down to the first div bot not the second div.
To take into account the possible floating elements (the infobox from top of page, using 300px) and the two floatting images (using 250px), you need to set right margins for the divs so that they won't use that space reserved for floating elements.
If you set the same right margin on both divs, their usable content width will be the same, and columns will align. However you used a margin of 25% which is either insufficient (on narrow screens) or too wide (on wide screens): the correct minimum is 300px (the width of the infobox with its border and left margin).
Note that I could compact more the lists using a gap=0 (gaps between columns are not needed for bulleted lists, given that the list already includes a left margin, within which the bullet fits with a minimum indentation, so the bullets cannot touch the column on the left; the bullets and the indentation of items already provides a sufficient gap of separation between columns). Additionally the list items are never longer than 14em, you used 20em for the columns width). verdy_p (talk) 19:33, 31 May 2016 (UTC)