This article mainly introduces the JS print interface CSS Center code, the need for friends can refer to the following
Code as follows: Function preview (oper) { if (Oper <) { bdhtml = window.document.body.innerhtml;//Get the HTML of the current page Code SPRNSTR = "<!--startprint" + oper + "-->";/Set print start area EPRNSTR = "<!--endprint" + oper + "-->"; Set Print End area prnhtml = bdhtml.substring (Bdhtml.indexof (SPRNSTR) + 18); Take html prnhtml = prnhtml.substring (0, Prnhtml.indexof (EPRNSTR)) from the Start Code;//forward from end code html Window.document.body.innerHTML = prnhtml; window.print (); Window.document.body.innerHTML = bdhtml; else { window.print (); } } #outer { display:table; height:400px; #posi tion:relative; overflow:hidden; } #middle { display:table-cell; vertical-align:middle; #position:absolute; #top:50%; } #inner { #position:relative; #top:-50%; }& nbsp <div id= "outer" > <div id= "Middle" > <div id= "inner" ≫ <!– Here is the content to be centered vertically –> </div> </div> </div>