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

In your stylesheet add:

@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}

Then add class="no-print" (or add the no-print class to an existing class statement) in your HTML that you don’t want to appear in the printed version, such as your button.

Leave a Comment