<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[page-break-inside: avoid in a CSS grid repeat?]]></title><description><![CDATA[<p>I have a div of a set of divs that I am using in a CSS grid repeat so that the column of text shows up as four columns across the page</p>
<pre><code>    #container {       
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }
</code></pre>
<p>I am having trouble eliminating a page break in the middle of a set of divs:<br />
<img src="/uploads/files/1657227309359-upload-f5906fd6-1bf7-450a-94a7-e237b6683813-resized.png" alt="0_1657227308119_upload-f5906fd6-1bf7-450a-94a7-e237b6683813" class="img-responsive img-markdown" /></p>
<p>Any ideas how to avoid this break? The incoming data content and number of sets will be dynamic, and the comments (the last line) will be of varying length. I have tried page-break-inside: avoid everywhere I can think of to no avail.</p>
]]></description><link>https://forum.jsreport.net/topic/2489/page-break-inside-avoid-in-a-css-grid-repeat</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 04:40:04 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/2489.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Jul 2022 20:56:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to page-break-inside: avoid in a CSS grid repeat? on Thu, 07 Jul 2022 20:57:40 GMT]]></title><description><![CDATA[<p>I have a div of a set of divs that I am using in a CSS grid repeat so that the column of text shows up as four columns across the page</p>
<pre><code>    #container {       
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }
</code></pre>
<p>I am having trouble eliminating a page break in the middle of a set of divs:<br />
<img src="/uploads/files/1657227309359-upload-f5906fd6-1bf7-450a-94a7-e237b6683813-resized.png" alt="0_1657227308119_upload-f5906fd6-1bf7-450a-94a7-e237b6683813" class="img-responsive img-markdown" /></p>
<p>Any ideas how to avoid this break? The incoming data content and number of sets will be dynamic, and the comments (the last line) will be of varying length. I have tried page-break-inside: avoid everywhere I can think of to no avail.</p>
]]></description><link>https://forum.jsreport.net/post/10778</link><guid isPermaLink="true">https://forum.jsreport.net/post/10778</guid><dc:creator><![CDATA[mmoye]]></dc:creator><pubDate>Thu, 07 Jul 2022 20:57:40 GMT</pubDate></item><item><title><![CDATA[Reply to page-break-inside: avoid in a CSS grid repeat? on Invalid Date]]></title><description><![CDATA[<p>hi! hmm the css grid does not support <a href="https://stackoverflow.com/questions/58879352/why-doesnt-page-break-work-with-css-display-grid" rel="nofollow">page-break-inside: avoid</a>.</p>
<p>so the only solution would be that you manually create an element with some pre-defined dimensions that are equal to a pdf page, let's call this element a container element, inside each container element there will be your CSS grid, so the grid gets attached to the container element dimensions and should not overflow it.</p>
<p>since your content is dynamic you will need to add some logic to create these container elements dynamically based on your content with javascript, so when this logic detects that a text is going to make the grid to overflow the container elements then that is the time you should create a new container element and put the text there. I know it is complex, but it is the only solution that comes to mind, unfortunately, the CSS grid is not aware of printing and therefore it behaves like this by default.</p>
]]></description><link>https://forum.jsreport.net/post/10787</link><guid isPermaLink="true">https://forum.jsreport.net/post/10787</guid><dc:creator><![CDATA[bjrmatos]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to page-break-inside: avoid in a CSS grid repeat? on Invalid Date]]></title><description><![CDATA[<p>Thank you for the quick reply! Yes that does sound like a complex work around. I will see what I can come up with. I appreciate your response and ideas for a solution.</p>
]]></description><link>https://forum.jsreport.net/post/10788</link><guid isPermaLink="true">https://forum.jsreport.net/post/10788</guid><dc:creator><![CDATA[mmoye]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to page-break-inside: avoid in a CSS grid repeat? on Invalid Date]]></title><description><![CDATA[<p>FYI I ditched the grid for a div with columns and it works just great. no JS required. Love simple solutions!</p>
]]></description><link>https://forum.jsreport.net/post/10800</link><guid isPermaLink="true">https://forum.jsreport.net/post/10800</guid><dc:creator><![CDATA[mmoye]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>