I want an image to be centered on a newly opened page,
margin:0 auto;text-align:center;
Try this:
<style>html,body{ margin: 0; padding: 0; height: 100%; }body{ position: relative; }.msg{ position: absolute; left: 50%; top: 50%; width: 400px; height: 400px; margin: -200px 0 0 -200px; }.msg img{ display: block; }</style>
body {text-align:center;}
#iframeDiv{margin:0 auto;}
<div id="iframeDiv" style="text-align:center;" > <img src="<%=basePath %>${request.fileSRC}"></div>
Just use the table, it will be absolutely centered.
Just use the form, it will be absolutely centered.
<div style="margin:auto;width: 100px;height: 100px;"> <table style="vertical-align:middle;width: 100px;height: 100px;"> <tr><td>放图片</td></tr> </table> </div>
body{text-align:center;}
margin:auto;
text-align:center ;