[英]Persisting the scroll position of DIV while printing
I would like to print scrollable div as WYSWYG.我想将可滚动 div 打印为所见即所得。 Is there a way?
有办法吗?
Try adding the below to the @media-print to persist scrolling during print.尝试将以下内容添加到 @media-print 以在打印期间保持滚动。 This worked for me:
这对我有用:
.className{
overflow: scroll;
}
Not with pure css, I don't think.不是纯 css,我不认为。 My...interpretation of what happens when you hit the print button is that the document's reloaded with either the
media="print"
or other relevant stylesheet, and then sent to print-preview/the printer as a new document, with all content in the default/start position as defined in that stylesheet.我...对点击打印按钮时发生的情况的解释是,文档重新加载了
media="print"
或其他相关样式表,然后作为新文档发送到打印预览/打印机,包含所有内容在该样式表中定义的默认/开始位置。
Since I can't think of a way to position the scrolling content, using css, I'd have to say that it's not possible.由于我想不出使用css定位滚动内容的方法,所以我不得不说这是不可能的。 Javascript's almost certainly the way to go on this one.
Javascript 几乎可以肯定是继续这个的方式。
...may I ask why you'd want to do this? ……请问您为什么要这样做? It's not a criticism, I just...don't understand.
这不是批评,我只是……不明白。
I don't think you can do it even with javascript.我认为即使使用 javascript 你也做不到。 It is against the spirit of the web.
这是违背网络精神的。 Printed document is supposed to look different.
打印的文档应该看起来不同。
I suspect that when you see a scroll bars on printed page, it is a bug to be fixed in future version of a browser.我怀疑当您在打印页面上看到滚动条时,这是一个需要在未来版本的浏览器中修复的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.