经常我们想要打印csdn里的文章,如果直接按Ctrl+p会连同网页上其他信息也一起打印出来。如何精确的csdn中文章,只需要将以下的代码的拷贝到Chrome下的开发者模式(F12)的Console中。
(function(){
$("#side").remove();
$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
$(".nav_top_2011, #header, #navigator").remove();
$(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box").remove();
$("aside").remove();
$(".tool-box").remove();
$("main").css('display','content');
$("main").css('float','left');
window.print();
$("tool-box").remove();
})();
将以上代码拷贝到Console中:
![CSDN图标](https://img-blog.csdnimg.cn/20191004105651137.png)
![CSDN图标](https://img-blog.csdnimg.cn/20191004110008112.png)