Using @media in bubble Plugin

I have a page that combines some reusable pages/elements. When user wants to print the whole page, I want each reusable element to be printed on a separate page. The easiest way (at least in theory) that I found was to create a simple Plugin that contains the following html code (per: CSS Page-break-after Property):

When bubble renders my page, I can see in the page source that the script has been added to the page but it simply doesnt add the page breaks on print. Any idea why this could be? Thanks

You can do this without a plugin. In your Settings > SEO Metatags section, you can add css code and there just add the code:
@media print { footer {page-break-after: always;} }
Just make sure you replace the “footer” with “#yourElementIdsToBreakAfter

Thank you William. I just added the line to “Script/meta tags in header” section of the SEO tab but when I refresh my “preview” page, I dont even see the new page-break-after in the page source code. Should i have added it elsewhere?

No, that is the right place. Did you give the elements you want to add a page break after an element ID and then put “#” then the name of the element ID in place of the word “footer”?

Also make sure you add it inside style tags like so:
<style> @media print { footer {page-break-after: always;} } </style>

I didnt choose an ID, I rather used “h1” as I want all heading 1 elements to print on top of the page. It didnt work. I even created a brand new test page with only a bunch of headers and used the h1, class name, or an ID name in the style element that you suggested but nothing works. It appears to me that bubble engine changes something behind the scene so the page doesnt behave as expected. Have you ever tried doing this in bubble and succeeded? I’m very curious. If you can do it on a page and I cant, I must be doing something wrong.

Yea I just tried it and I could not get it to work with the method we have been discussing so I guess something with the way Bubble’s style is probably added affects this.

On the one hand, I’m glad that I’m losing my mind. On the other hand, it’s one of those oh crap moments for me as I need to figure out a solution for the page break problem. Thanks anyway for your help William.