如何隐藏滚动条并使内容保持可滚动状态? [英] How to hide the scroll bar and with the content ramaining scrollable?
问题描述
我想将html页面打印为PDF文件,但不希望滚动条显示在PDF文件中.而且我的页面具有可滚动的正文,因此,如果我设置为:
I want to print my html page into a PDF file, but don't want the scroll bar showing there in the PDF file. And my page have a scrollable body, so if I set this:
* {
overflow: hidden;
}
最终的pdf文件中的正文将不完整. 因此,是否有办法阻止滚动条显示,但内容仍可滚动?
The body will be incomplete in the final pdf file. So if there is a way just prevent the scrollbar from showing but the content still scrollable?
推荐答案
有一条CSS规则可以隐藏基于Webkit的浏览器(Chrome和Safari)中的滚动条.该规则是:
There is a CSS rule that can hide scrollbars in Webkit-based browsers (Chrome and Safari). That rule is:
.element::-webkit-scrollbar { width: 0 !important }
有一条CSS规则可以隐藏IE 10+中的滚动条.该规则是:
There is a CSS rule that can hide scrollbars in IE 10+. That rule is:
.element { -ms-overflow-style: none; }
曾经有一个CSS规则可以在Firefox中隐藏滚动条,但此后不推荐使用.该规则是:
There used to be a CSS rule that could hide scrollbars in Firefox, but it has since been deprecated. That rule was:
.element { overflow: -moz-scrollbars-none; }
这篇关于如何隐藏滚动条并使内容保持可滚动状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!