Placement of absolutely positioned elements incorrect when printing - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

Placement of absolutely positioned elements incorrect when printing

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
      <script>
      $(function () {/*from  w w  w. j  a v a 2 s .  c om*/
          $('#test').text($('#test').width());
      });
    
      </script> 
      <style type="text/css">

#test {
   width: 100%;
   border: 1px solid black;
}
@media print {
   #test {
      width: 100px;
   }
}


      </style> 
   </head> 
   <body> 
      <div id="test"></div>  
   </body>
</html>

Related Tutorials