【问题标题】:body:after appears on each printed pagebody:after 出现在每个打印页面上
【发布时间】:2020-04-03 23:40:16
【问题描述】:

我想打印两张网站。我只使用body:after 进行打印。问题是 :after 的内容出现在两个打印页面上。

body:after {
    content: "This printout is intended for the customer. Please keep it in a safe place.";
    position: absolute;
    bottom: 0px;
}

为了更好地理解:我想打印两张内容几乎相同的纸,除了后面的引号。

我用 Jquery 的clone() 克隆了#content,但我没有克隆整个正文。 我该如何解决这个问题?或者有没有更好的方法来做这件事?

【问题讨论】:

  • 您可以创建一个 DIV 并使用隐藏属性仅打印该 DIV 内的内容,假设您正在使用引导程序。此外,您应该从 CSS 文件中删除绝对位置
  • 我没有使用 cms,但是这个技巧应该可以工作还是?我想要在工作表底部的报价。那我还应该做什么?
  • function PrintElem(elem) { var mywindow = window.open('', 'PRINT', 'height=400,width=600'); mywindow.document.write(' ' + document.title + ''); mywindow.document.write(''); mywindow.document.write('

    ' + document.title + '

    '); mywindow.document.write(document.getElementById(elem).innerHTML); mywindow.document.write(''); mywindow.document.close(); // 对于 IE >= 10 是必需的 mywindow.focus(); // 对于 IE >= 10 */ mywindow.print(); 是必需的mywindow.close();返回真; }

标签: javascript jquery css printing


【解决方案1】:

当你克隆 jQuery 时,为什么不在正文后附加“你的报价”和 jQuery?或者你想要的地方!然后你打印它!并且您决定要附加到哪个页面!

body.append('<div style="position:absolute; bottom:0px;">Your quote</div>');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-11
    • 2017-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多