CSS分页媒体:最后一页选择器 [英] CSS paged media :last page selector

查看:370
本文介绍了CSS分页媒体:最后一页选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道是否可以使用:last选择器修改最后一页上的内容.

I need to know if I can modify content on the last page with the :last selector.

我不确定它是否存在,我是否看到它正在其他stackoverflow答案中使用,例如:文档中找不到它,并且当我无法使用时尝试使用它.

I'm not sure if it exists, I see it being used in other stackoverflow answers like this: Footer on last printed page. But I can't find it in the documentation and it does not work when I try to use it.

我正在尝试清除最后一页页脚中的内容,如下所示:

I'm trying to clear the content on the footer of my last page like this:

@page {
        @bottom-right {
            content: "Please turn over";
        }
}

@page :last {
        @bottom-right {
            content: none;
        }
}

当与:first选择器一起使用时,它可以工作.如何获得最后一页的效果?

It works when I use it with the :firstselector. How can I get the effect for the last page?

我正在使用Weasyprint打印PDF文件.

I'm using Weasyprint to print PDF files.

推荐答案

基于 CSS3页面文档,看来:last伪类已被删除(或从不包含).

Based on the CSS3 Page docs it appears the :last pseudo-class was removed (or never included).

如果可以在文档末尾强制分页符,则可以使用:blank伪类定位最后一页.但是,这可能会对其他空白页产生不良影响.

It might be possible to target the last page using the :blank pseudo-class if you can force a page break at the end of your document. This might have unwanted effects on other blank pages though.

这篇关于CSS分页媒体:最后一页选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆