如果直接在CSDN頁(yè)面上Ctrl + P打印轩褐,肯定會(huì)是頁(yè)面顯示不全椎咧,格式不正確,等等把介。
這是因?yàn)轫?yè)面的CSS等元素干擾了打印勤讽。只要把那些干擾元素刪除,再打印就OK了拗踢。
- 打開Chrome或者Firefox的開發(fā)者工具的console脚牍。(設(shè)置->更多工具->開發(fā)者工具)
- 將代碼粘貼到console中巢墅,回車。如下:
(function(){
$("#side").remove();
$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
$(".nav_top_2011, #header, #navigator").remove();
$(".csdn-side-toolbar,.template-box,.reward-user-box").remove();
$(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box,#dmp_ad_58").remove();
$("aside").remove();
$(".tool-box").remove();
$("main").css('display','content');
$("main").css('float','left');
$("#mainBox").css('width','1048px');
$("#mainBox").css('margin-left','0px');
$("#mainBox").css('margin-right','0px');
//$("[class='main_father clearfix d-flex justify-content-center']").css("width","1048px");
$(".main_father.clearfix.d-flex.justify-content-center").css("width","1048px");
window.print();
$("tool-box").remove();
})();
來源于網(wǎng)絡(luò),侵刪