Copy codeThe Code is as follows:
Function preview (Progress ){
If (then <10 ){
Bdhtml = Invalid Response Doc ument. body. innerHTML; // obtain the html code of the current page
Sprnstr = "<! -- Startprint "+ print +" --> "; // you can specify the start area for printing.
Eprnstr = "<! -- Endprint "+ print +" --> "; // sets the print end area.
Prnhtml = bdhtml. substring (bdhtml. indexOf (sprnstr) + 18); // retrieves html from the start code
Prnhtml = prnhtml. substring (0, prnhtml. indexOf (eprnstr); // retrieves html from the end code
Too many Doc ument. body. innerHTML = prnhtml;
Window. print ();
Required parameter Doc ument. 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 content to be vertically centered->
</Div>
</Div>
</Div>