我刚得到这个 wordpress 主题: http://meezio.pixelworkshop.fr/
非常好,问题是因为它是一个单页模板,每当我尝试打印我当前正在查看的页面时,它总是打印第一页,我理解为什么浏览器会这样做并且它按预期工作,但是有没有办法准确打印当前屏幕上的内容以请求打印页面?
顺便说一句,我将所有样式表的 media="screen"更改为 media="all",以便样式在打印页面上正确显示,但无论如何仍然显示第一张幻灯片。如果您转到博客部分或任何类别,它工作正常,因为这些页面没有幻灯片功能。
有人知道我该怎么做吗?
提前致谢。
最佳答案
参见 this question使用建议的解决方案
- Give the body and the HTML tag 100% height
- Give the body a "overflow: hidden"
- Put the contents of your page into a 100% wide, 100% tall DIV with overflow:auto
- Scroll to the desired position and click "print"
重要的是这个问题没有明确的解决方案,但是通过一些技巧,您可以尝试完成您需要的。
补充阅读:Restricting printing to selected HTML elements only或 see here
关于css - 打印单页网站时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5318649/