添加页脚以打印网页并设置页边距

问题描述:

我想向HTML页面添加页脚,以便在打印时在所有页面上重复.我设法通过以下代码实现了这一点:

I want to add a footer to an HTML page that will be repeated across all pages WHEN PRINTING. I have managed to achieve this through this code:

@media print {
    p.note {
        bottom: 0; position: fixed; 
    }
}

但是现在我在复制其余部分的顶部出现了问题

But now I have a problem with this paragraph going on top of the rest of the copy

根据此Mirosoft 文章 >,这应该对我有用:

According this Mirosoft article, this should work for me:

@page :first {
    margin-bottom: 4in;
}

但是它不会,它不会改变任何...任何想法?

But it doesn't, it doesn't change anything... any ideas?

这是有效的解决方案,CSS是这样的:

Here's the solution that worked, CSS is this:

@media print {
    p.note {
        display:block;
        bottom:0;
        position:fixed;
        font-size:11px;
    }
}

所有内容都需要与此CSS一起包含在单独的div中

And everything needs to be contained in a separate div with this CSS

#wrapper {
    position:relative;
    bottom:1in;
    margin-top:1in;
    width:974px;
    margin:0 auto;
}

这很好用!