I have a simple multi-column layout with one outer and multiple inner containers. The outer container has the column-count property applied, so all the inner containers and their content flow in two columns. Most of the inner containers have one H1, which spans over both columns.
When I add a page break before one of the inner containers now, I will not only get the intentional page break before the container, but also another one after the H1 with the column-span property applied:
If I add more elements with column-span: all applied, i.e. more headlines, even more page breaks will be added. Is this intended behaviour? Or is it a bug? If so, can it be fixed or is there a workaround?
Note that some of the containers do not have a H1 and should flow immediately after the previous container has ended. For this reason the column-count property is applied to the outer container and not to the inner containers individually.
can somebody confirm this bug or is it a problem with my setup? Am I doing something wrong here? If I can do something to help like testing, please don't bother asking.
yes this works. However, one needs to be careful because this may lead to side effects such as the TOC being off a page, when chapters have large margin/paddings. So one chapter starts on page 2, but the H1 appears on page 3. Linking to this chapter will give you the wrong page number, from a visual point of view.
after simplifying our HTML structure we have been running some tests again, eventually reproducing described behaviour above. However, we have nailed down the problem now. Consider this example:
<!doctype HTML>
<html>
<head>
<title>column span test</title>
<style>
article {
column-count: 2;
}
section {
page-break-before: always;
}
.column-span-all {
column-span: all;
background-color: #ccc;
}
</style>
</head>
<body>
introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction introduction
<article>
<section>
some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text
<div class="column-span-all">
highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1 highlighted text 1
</div>
some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2 some text 2
<div class="column-span-all">
more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2 more highlighted text 2
</div>
some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3 some text 3
</section>
<section>
next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section next section
</section>
</article>
</body>
</html>
The "column-count" property is set for the <article> element.
Usually various <section> elements appear as children in the article element. They all should not be separated but flow as you would expect it in a two-column layout. Unless we want to manually add a break, as it is defined here.
If in one of the <section> elements there is an element with the "column-span" property set to "all", this will induce a page break before and after this element.
It appears as if the <article> (or <section>) element is internally somehow closed before the element with "column-span" set to "all" and reopened afterwards, provoking the additional page breaks.
Is this intended behaviour, I guess not? Can you look into this or at least tell me, if this is easy to fix or when it will be fixed? Do you need support in testing?
If this is not intended, this is a pretty serious bug, because documents with articles and sections, as well as nested sections are becoming more and more common.
Hi John, excellent demos - thank you! I've taken the liberty of adding them to a GitHub repository I've started, with miscellaneous random tests from the forum. This is going to be useful both to verify a fix when the developers get to this, and to make sure it doesn't regress again later on.
This is a brand new repository, I've just started filling it with bits of miscellany that gets posted here. Feel free to do pull requests if you come across issues