为什么CSS3 @page规则不起作用? [英] Why aren't CSS3 @page rules working?

查看:1754
本文介绍了为什么CSS3 @page规则不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一份很容易从我的WordPress网站生成的打印报纸。我试图为它设计打印模板,但为了控制特定的页面,我需要使用 @page 规则。

I am trying to make a print newspaper that is easily generated from my WordPress site. I am trying to design the print template for it, but in order to control specific pages, I need to use the @page rule.

我阅读了本教程,其中提供了以下方法:

I read this tutorial, which suggests methods like:

@page :left {
  @top-left {
    content: "Cascading Style Sheets";
  }
}

但是当我在Firefox 5 14)打印预览或打印,它不会在左上角打印任何东西。事实上,我似乎不能在 @page 规则中做任何事。

But when I try this in Firefox 5 (and Chrome 14) print-preview or print, it does not print anything at the top-left. In fact, I can't seem to do anything within the @page rule.

我做错了

推荐答案

刚才的前言后,教程指出:

Just after the preface, the tutorial states:


网络浏览器适合处理屏幕上的像素,但打印效果不佳。要打印完整的书,我们转而使用 Prince ,这是一个专用的批处理器,可通过CSS将XML转换为PDF。 Prince支持CSS2的打印特定功能,以及为CSS3提供的功能。

Web browsers are good at dealing with pixels on a screen, but not very good at printing. To print a full book we turned to Prince, a dedicated batch processor which converts XML to PDF by way of CSS. Prince supports the print-specific features of CSS2, as well as functionality proposed for CSS3.

因此,教程代码不是用于浏览器的打印功能。

So, the tutorial code isn't meant for use with a browser's print function in the first place.

在任何情况下,正如我在评论中所说的,我不会指望任何实现这个功能的浏览器。每个人都对现在的动画在屏幕上发生的事情感到疯狂。

In any case, as I said in my comment, I wouldn't count on any browser implementing this yet. Everyone's crazy about the stuff happening on screen like animations right now.

这篇关于为什么CSS3 @page规则不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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