Note that there are some explanatory texts on larger screens.

plurals
  1. PONever allow two elements to split CSS3 Columns
    primarykey
    data
    text
    <p>I'm having trouble keeping two elements "together" using CSS3 columns. Consider the following HTML:</p> <pre><code>&lt;div style="column-count: 2"&gt; &lt;!-- I'm aware there's more CSS rules needed --&gt; &lt;div class="heading"&gt;Heading 1&lt;/div&gt; &lt;div class="content"&gt;Long paragraph text goes in here lalalalala&lt;/div&gt; &lt;div class="heading"&gt;Heading 2&lt;/div&gt; &lt;div class="content"&gt;Some longer paragraph text goes in here&lt;/div&gt; &lt;/div&gt; </code></pre> <p>In Chrome, Firefox and Safari this displays as I would like it to:</p> <pre><code>Heading 1 | Heading 2 Long paragraph text goes | Some longer paragraph text goes in here lalalalala | in here </code></pre> <p>I've used the following CSS to "stick" the heading and the content <code>&lt;div&gt;</code>s together:</p> <pre><code>.heading {padding-bottom: 30px;} .content {margin-top: -30px;} </code></pre> <p>This ensures that the heading is not the last item in one column, with the content in the next column. However this is exactly what happens in IE10:</p> <pre><code>Heading 1 | Some longer paragraph text goes Long paragraph text goes | in here in here lalalalala | Heading 2 | </code></pre> <p>Keep in mind that there can be many <code>#heading</code> and <code>#content</code> divs in each column, so it's not enough to simply use a <code>break-after: always</code> on the heading.</p> <p>Also, it's not enough to wrap both elements in another div and add <code>break-inside: avoid;</code> on that div, because <code>#content</code> divs have to be able to flow between columns.</p> <p>What I'm after is some CSS to ensure that the heading and content div don't get split up at the column break.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload