Firefox printing only 1st page

后端 未结 15 2459
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 05:40

I\'m working on print friendly css for a website. It previews/prints perfectly in IE, but Firefox (version 3.6) only previews/prints the 1st page.

Is anyone aware of

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 06:08

    After a lot of research and trial & error, I have found this article by A list apart. I was skeptical because it's so old but it states that:

    If a floated element runs past the bottom of a printed page, the rest of the float will effectively disappear, as it won’t be printed on the next page.

    As I have a big floated container I thought I'd give it a try. So, I made a mix from other answers and this article and came up with this:

    body { 
        overflow: visible !important; 
        overflow-x: visible !important; 
        overflow-y: visible !important; 
    }
    
    /*this is because I use angular and have this particular layout*/
    body > .fade-ng-cloak { 
        height: 100%; 
        display: block;
        flex: none;
        float: none;
    }
    .l-content,
    .l-sidebar {
        float: none;
    }
    

    So basically:

    1. Setting body to overflow: visible
    2. Setting elements that behave as wrappers to display: block, eliminate all flex styles and reset height if necessary
    3. Eliminate float on long containers

    That mix worked for me! I'm so happy I thought I'd share :)

提交回复
热议问题