title: how to Styling for printing in JavaScript
body: <p>to print the contract, I want to do some parts of the table in the middle of the line and look like what you see in the picture</p>
  <p>I did them correctly in View, but in JavaScript I want them to look like View in print.</p>
  <p>If I put text-align: center in the style, the whole form will be centered, which I do not want. Please help</p>
  <pre><code>&lt;div class=&quot;row justify-content-around&quot;&gt;
      &lt;b id=&quot;d2&quot;&gt;   امضاء و اثر انگشت کارگر&lt;/b&gt;
     
  
      &lt;b id=&quot;d1&quot;&gt;امضاء و مهر کارفرما&lt;/b&gt;
  
  &lt;/div&gt;
  
  &lt;script&gt;
  
      function printDiv() {
          var divToPrint = document.querySelectorAll('.print-table');
          var htmlToPrint = '' +
              '&lt;style type=&quot;text/css&quot;&gt;' +
              'table th, table td {' +
              'font-family:vazir;' +
              'border:1px solid #000;' +
              'padding:0.5em;' +
              '}' +
              '&lt;/style&gt;';
  
          divToPrint.forEach((item) =&gt; {
              htmlToPrint += item.outerHTML;
          })
          newWin = window.open(&quot;&quot;);
          newWin.document.write(htmlToPrint);
          newWin.print();
          newWin.close();
      }
  
  &lt;/script&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/dengX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dengX.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/GW5MD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GW5MD.png" alt="enter image description here" /></a></p>