Home >Web Front-end >HTML Tutorial >Newbie asking for help, page centering problem_html/css_WEB-ITnose
I want an image to be centered on a newly opened page,
d1b014258ea667119ef69d7afcbe9c30
230d9fe4f877d8d3de0d62f16e5100d6${request.fileSRC}">
16b28748ea4df4d9c2150843fecfba68
This does not fully satisfy
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.
75e4cee95f201f1bf4e39626cb0d15a5
6af3db7b5bf00d81dcd117e311b49cbf
e57f90d480425b3a1c5fe0007e482b59
< ;td>
16b28748ea4df4d9c2150843fecfba68
Just use the form, it will be absolutely centered.
75e4cee95f201f1bf4e39626cb0d15a5
6af3db7b5bf00d81dcd117e311b49cbf
e57f90d480425b3a1c5fe0007e482b59
< ;td>
16b28748ea4df4d9c2150843fecfba68
<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 ;