How do I hide an element when printing a web page?

前端 未结 10 1052
-上瘾入骨i
-上瘾入骨i 2020-11-22 03:34

I have a link on my webpage to print the webpage. However, the link is also visible in the printout itself.

Is there javascript or HTML code which would hide the lin

10条回答
  •  死守一世寂寞
    2020-11-22 04:18

    The accepted answer by diodus is not working for some if not all of us. I could not still hide my Print this button from going out on to paper.

    The little adjustment by Clint Pachl of calling css file by adding on

          media="screen, print" 
    

    and not just

          media="screen"
    

    is solving this problem. So for clarity and because it is not easy to see Clint Pachl hidden additional help in comments. The user should include the ",print" in css file with the desired formating.

         
    

    and not the default media = "screen" only.

        
    

    That i think solves this problem for everyone.

提交回复
热议问题