最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to hide header & footer in printing page (window.print()) function in safari browser? - Stack Overflow

programmeradmin4浏览0评论

I need to hide header and footer section in printing page . I have used below css code to hide the header and footer .

 @page    {
  size: auto;  
  margin: 0;  
 }

Its only working in chrome & Firefox. But not working in safari. How can I fix this ? Please help me to find solution.

I need to hide header and footer section in printing page . I have used below css code to hide the header and footer .

 @page    {
  size: auto;  
  margin: 0;  
 }

Its only working in chrome & Firefox. But not working in safari. How can I fix this ? Please help me to find solution.

Share Improve this question asked May 17, 2017 at 5:10 user7726968user7726968 611 gold badge1 silver badge7 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 3

According to caniuse., @page is not supported by Safari. Actually, size property is not supported well in IE/Edge and Firefox, so it is better not to use it.

To hide header and footer in print page. Maybe you can use media query:

@media print {
  header,footer { 
    display: none; 
  }
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论