[英]Hide Vertical Scrollbar in Chrome while printing
overflow: hidden
is the css property you are looking for. overflow: hidden
是您要查找的CSS属性。 It removes the scrollbar and removes overflowing content. 它删除滚动条并删除溢出的内容。 See: https://developer.mozilla.org/en/docs/Web/CSS/overflow
请参阅: https : //developer.mozilla.org/en/docs/Web/CSS/overflow
<style>
@media print{
@page {
size: A4 portrait;
margin:1cm;
overflow: hidden;
}
}
</style>
Or try to set the overflow hidden without depending on the media query: 或者尝试不依赖于媒体查询就将溢出设置为隐藏:
html { overflow: hidden; }
If this does not help for printing, maybe have a look at the answer of following question: How to hide the scroll bar and with the content ramaining scrollable? 如果这对打印没有帮助,请查看以下问题的答案: 如何隐藏滚动条并保留可滚动的内容?
As mentioned there you could try to set the width of the scrollbar to zero for webkit browsers. 如前所述,您可以尝试将webkit浏览器的滚动条宽度设置为零。
This is the solution I found: 这是我发现的解决方案:
@media print{
@page {
size: A4 portrait;
margin:1cm;
}
::-webkit-scrollbar {
display: none;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.