CSS @Page { size:landscape} 过时了吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4249532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is @Page { size:landscape} obsolete?
提问by Paul Keister
The CSS rule
CSS 规则
@page {size: landscape;}
is supposed to force browsers to print pages in landscape mode. This rule is mentioned in many questions on stackoverflow, on many other programming sites, and in reference works such as O'Reilly's HTML/XTHML The Definitive Guide, Fifth Edition.
应该强制浏览器以横向模式打印页面。此规则在有关 stackoverflow 的许多问题、许多其他编程站点以及 O'Reilly 的 HTML/XTHML The Definitive Guide, Fifth Edition 等参考著作中都有提及。
I've tried to using this CSS rule with many different format tweaks with both inline styles and linked style sheets, specifying media and not specifying media, with IE8, Chrome 7.0, and Firefox 3.6. I've tried printing to a Xerox Phaser 8560 and to the Adobe PDF print driver. All of my testing has been done on Windows Vista Ultimate 64 bit.
我已经尝试将这个 CSS 规则与许多不同的格式调整一起使用,包括内联样式和链接样式表,在 IE8、Chrome 7.0 和 Firefox 3.6 中指定媒体和不指定媒体。我试过打印到 Xerox Phaser 8560 和 Adobe PDF 打印驱动程序。我所有的测试都是在 Windows Vista Ultimate 64 位上完成的。
I have never see this CSS rule actually work, i.e. I've never seen a page print landscape on any attempt. Admittedly I haven't done really thorough QA on this, since I've only tried 2 printer drivers and one OS.
我从来没有见过这个 CSS 规则真正起作用,即我从来没有见过任何尝试的页面打印横向。诚然,我还没有对此进行真正彻底的 QA,因为我只尝试了 2 个打印机驱动程序和一个操作系统。
Have you actually seen this rule work for a browser, OS, and printer configuration? There is some mention in other questions on this topic that the rule is not broadly supported. Since I can't get it to work on my development machine at all I am wondering when, if ever, does it work? It would help to get specifics on browser, OS, and printer combinations that are known to work, or to confirm that this is a waste of time.
您是否真的看到此规则适用于浏览器、操作系统和打印机配置?在有关此主题的其他问题中,有人提到该规则并未得到广泛支持。因为我根本无法让它在我的开发机器上工作,所以我想知道它什么时候工作,如果有的话?这将有助于获取已知可以工作的浏览器、操作系统和打印机组合的详细信息,或者确认这是在浪费时间。
采纳答案by Phrogz
CSS 2.1no longer specifies the size
attribute. The current working draft for CSS3 Paged Media moduledoes specify it (but this is not standard or accepted). I have not been able to find a report of specific browser/version support, but I get the sense that it is poorly supported (perhaps only by Opera?).
CSS 2.1不再指定该size
属性。CSS3 Paged Media 模块的当前工作草案确实指定了它(但这不是标准的或被接受的)。我无法找到特定浏览器/版本支持的报告,但我觉得它的支持很差(也许只有 Opera?)。