How to hide an element when printing a web page?

By IncludeHelp Last updated : November 13, 2023

To hide an element while printing a webpage, you need to write a media print query and set the CSS visibility style to "hidden". This CSS property disables printing of an element.

Use the below CSS style to hide an element for printing a webpage,

@media print {
   #printdisable {
      visibility: hidden;


In this example, we are hiding a DIV element when printing. Just use the class/id name that you created in the CSS style.

<div id="printdisable">
   Content or set of the elements that you want to hide.

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.