title: Print HTML div with styles not working with bootstrap
body: <p>I'm trying to print a div content using Javascript. I am using external css files for styling. But print document do not apply styles after adding <code>bootstrap.css</code>.</p>
  
  <p>Here is my code.</p>
  
  <p>HTML page</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Print Div Test&lt;/title&gt;
          &lt;link href="css/mycss.css" rel="stylesheet" /&gt;
          &lt;link href="css/bootstrap.css" rel="stylesheet" /&gt;
  
          &lt;script src="js/lib/jquery-1.11.1.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
  
              function PrintElem() {
                  Popup($('#mydiv').html());
              }
  
              function Popup(data) {
                  var mywindow = window.open('', 'my div', 'height=400,width=600');
                  mywindow.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;my div&lt;/title&gt;');
                  mywindow.document.write("&lt;link rel=\"stylesheet\" href=\"css/bootstrap.css\" type=\"text/css\" media=\"print\" /&gt;");
                  mywindow.document.write("&lt;link rel=\"stylesheet\" href=\"css/mycss.css\" type=\"text/css\"  /&gt;");
                  mywindow.document.write('&lt;/head&gt;&lt;body &gt;');
                  mywindow.document.write(data);
                  mywindow.document.write('&lt;/body&gt;&lt;/html&gt;');
  
                  mywindow.print();
                  //mywindow.close();
  
                  return true;
              }
  
          &lt;/script&gt;
      &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          &lt;div id="mydiv" class="row"&gt;
              &lt;h1&gt;This will be printed. &lt;/h1&gt;
              &lt;div class="col-md-6"&gt;
                  &lt;div style="color: red"&gt;In line styles applied.&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6"&gt;
                  &lt;div class="myclass"&gt;Style from sheet&lt;/div&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
  &lt;input type="button" value="Print Div" onclick="PrintElem()" /&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>CSS File</p>
  
  <pre><code>.myclass {
      color: greenyellow;
  }
  </code></pre>
  
  <p>Is it a problem with media queries? Before adding bootstrap it works with other style. </p>