Forum How do I...?

Column-count anomalies; any ideas?


A Prince anomaly that I've noticed over the years:
"column-count: #" often returns strange results, not what I
specified. All the basic stuff within my columns definition
works fine (font-size, font-family), and "column-count: 2"
almost always works fine, but when I go to 3 or 4 columns, it
gets strange, sometimes obeying me, sometimes not; usually
not. Sometimes, when I alter the column-width, it obeys as to
the width, but switches from (say) the specified 3 columns to
4 columns (or 5). Sometimes, changing the font size will cause
2 columns to switch to 3, though the font size change is
rendered correctly.

Example: THIS code:

.mycols { font-size: 10pt; font-family: Arial;
column-count: 3; column-width: 1.1in;
text-align: left; hyphens: auto; }

.... returns FIVE columns.

When I change column-width to 1.3in instead of 1.1in, Prince
returns four columns (while column-count is still set to 3).

When I change column-count to 4, and column-width to 1.2in,
Prince returns five columns.

When I change column-count to 3, and column-width to 1.3in,
and font-size to 8pt, Prince returns five columns (with the
font-size correctly rendered).

When I change column-count to 2, and column-width to 2in,
and font-size to 8pt, Prince returns three columns (with the
font-size correctly rendered).

And so on. Not much rhyme or reason -- except that it feels
like Prince has an internal imperative to fill the entire
width of the page with columns, regardless of how many columns
you specify.

I usually only use two columns, and I almost always get the
results I want, but there are times when I wish I could
get 3 or 4 columns reliably, of the width I specify (and
please forget about the page width, which is irrelevant;
I want what I specify!).

Any ideas? Has anyone else noticed this?
The column-width property overrides column-count, so if you want a specific number of columns of a specific width you will need to just use column-count and set the width of the parent element.
(I think this is a Prince bug, we should be capping the number of columns with column-count).
Hmm actually maybe it isn't, I think column-width only specifies the minimum width if column-count is also specified, so you will still need to set a width on the container in order to constrain the maximum width.
Mike, you're amazing. An answer within 2 minutes on SUNDAY NIGHT! An answer that makes perfect sense, and it WORKS, too. Now I'm wondering why I did not think of that. Anyway: thanks! And please take some time for yourself, ok?
In fairness it's a Monday afternoon here in Melbourne, but you're welcome. :D
Hey Mike,

I just ran into this too: per column-count should effectively set a maximum number of columns when column-count and column-width are both not auto.

Don't seem to have any tests in the testsuite for this, though. :( *goes off and writes one*