I am trying to print a page upon loading it and I have been trying to print the page with @media print inside CSS but I cant get it to work, no matter what I do.
Only thing I need to do is to apply colors in the <th> tags.
HTML Code:
<body onload="window.print();">
<div>
  <h2 class="text-center"><span class="label label-default">Order Form Details</span></h2><br>
  <table class="table table-hover table-responsive">
    <thead>
      <tr>
        <th>Name</th>
        <th>Surname</th>
        <th>Telephone</th>
        <th>Postal Code</th>
        <th>Priority</th>
      </tr>
    </thead>
    <tbody>
    <tr>
        <td>1</td>
        <td>1</td>
        <td>1</td>
        <td>1</td>
        <td>1</td>
      </tr>
    </tbody>
  </table>
</div>
</body>
CSS Code:
th {
   background-color: #C8C8C8;
}
JSFiddle here
 
     
    