简体   繁体   English

使用媒体查询打印隐藏的div

[英]Print a hidden div using Media Queries

HTML 的HTML

 <div id="printcontent">
    //some data: mostly images
        </div>

I want to print the above div using Media Queries. 我想使用媒体查询来打印上面的div。

Please note that the above div is set to: Display:none; 请注意,以上div设置为:Display:none; in css; 在CSS;

Here is the Demo: http://jsfiddle.net/Ryh3G/ 这是演示: http : //jsfiddle.net/Ryh3G/

The print dialog is not appearing. 打印对话框没有出现。 It should work in all browsers. 它应该在所有浏览器中都可以使用。 Thanks for your help. 谢谢你的帮助。

It works good.choose 'No wrap - in <head>' in right sidebar @fiddle 效果很好'No wrap - in <head>'在右侧边栏@fiddle中选择'No wrap - in <head>'

function functionPrint()
{    
 window.print();   
}

DEMO 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM