1

Element should be hidden in media screen while include it when user want to print the page.

I use this CSS code but not working.

@media screen {
    th .hide {
      display: none;
    }
}

@media print {
    th .hide {
        border: 1px solid #000; 
        padding: 0.5em;
    }
}

html is like this:

<table>   
    <tr>
        <th class="hide" > Office:    
    </tr>
</table>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

1

Here a similar post

The best practice is to use a style sheet specifically for printing, and and set its media attribute to print.

In it, show/hide the elements that you want to be printed on paper.

<link rel="stylesheet" type="text/css" href="print.css" media="print" />
Community
  • 1
  • 1
Rémy Testa
  • 897
  • 1
  • 11
  • 24
  • i think you misunderstood the question. I want an element to be hidden in the screen but print it anyway. Else your answer is not to the point. – Wilnar Vincent Jan 21 '16 at 00:01