Reputation: 35051
I have the following
@media print {
DIV {
display: block;
}
}
<html>
<body>
<div style="display:none">You can't see me!</div>
</body>
</html>
But when I tried this, I still couldn't see "You can't see me!" when I print. How can I get this to show up for printing?
Upvotes: 0
Views: 64
Reputation: 114
First of all, from your code I can see you use an inline style of display: none
. This will prevent the div from showing. Remove the inline style to correct this.
Upvotes: 1
Reputation: 2984
Assign a class to your div
so you can specify what needs to be seen when being printed:
<html>
<body>
<div class="print-only">You can't see me!</div>
</body>
</html>
Then your CSS would look like:
.print-only {
display: none;
}
@media print {
.print-only {
display: block !important;
}
}
Upvotes: 3