JS printing interface CSS center code for all browsers
function preview(oper) {if (oper < 10) {bdhtml = window.document.body.innerHTML;//Gets the HTML code for the current pagesprnstr = "<!--startprint" + oper + "-->";//Set the print start areaeprnstr = "<!--endprint" + oper + "-->";//Set the end of print areaprnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //Fetch the HTML back from the starting codeprnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//Fetch the HTML forward from the closing codewindow.document.body.innerHTML = prnhtml;window.print();window.document.body.innerHTML = bdhtml;} else {window.print();}}#outer {display:table;height:400px;#position:relative;overflow:hidden;}#middle {display:table-cell;vertical-align:middle;#position:absolute;#top:50%;}#inner {#position:relative;#top:-50%;}<div id= " outer " ><div id= " middle " ><div id= " inner " ><! Here is the vertically centered content ></div></div></div>