How to apply some styles to first and last elements on a print page?
问题 I have the following dummy code: <!doctype html> <html> <head> <style> p {font-size: 20px;} </style> </head> <body> <script type="text/javascript"> window.onload = function () { var body = document.getElementsByTagName('body')[0], p = document.createElement('p'), el; p.style.height = '20px'; p.innerText = 'Some Test'; for (var i = 0, len=30; i<len; i++) { el = p.cloneNode(true); body.appendChild(el); } }; </script> </body> </html> It's render some elements and on page preview it looks like