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

前端 未结 10 1042
-上瘾入骨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:15

    Bootstrap 3 has its own class for this called:

    hidden-print
    

    It is defined like this:

    @media print {
      .hidden-print {
        display: none !important;
      }
    }
    

    You do not have to define it on your own.


    In Bootstrap 4 this has changed to:

    .d-print-none
    

提交回复
热议问题