How to only show certain parts with CSS for Print?

后端 未结 6 635
悲&欢浪女
悲&欢浪女 2020-11-27 20:22

I have a page with lots of data, tables and content. I want to make a print version that will only display very few selected things.

Instead of writing another page

6条回答
  •  有刺的猬
    2020-11-27 20:26

    If you want to display some links etc. when in the browser, that you don't want to be printed. Furthermore you have some logos and letterhead info that only should go on the printed page. This seems to work fine:

    Example:

    CSS:

    @media print {
      .noPrint {
          display:none;
      }
    }
    @media screen {
       .onlyPrint {
           display: none;
       }
    }
    

    HTML:

    
    

提交回复
热议问题