利用vertical-align:middle实现在整个页面居中
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>404页面</title> </head> <body> <div class="wall"> <a href="index.html"><img class="img404" src="images/404.jpg" alt="404页面" /></a> </div> </body> </html> <style type="text/css"> body{ margin:0; background:#333; _height:100%;} .wall{ width:100%; height:100%; position:absolute; left:0; top:0; text-align:center;} .img404{ border:0;width:700px;} </style> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>404页面</title> <style type="text/css"> body{ margin:0; background:#333; _height:100%;} .wall{ width:100%; height:100%; position:absolute; left:0; top:0; text-align:center; font-size:0;} .img404{ border:0; width:700px; vertical-align:middle;} .verticalAlign{ vertical-align:middle; display:inline-block; height:100%; width:1px; margin-left:-1px;} </style> </head> <body> <div class="wall"> <span class="verticalAlign"></span> <a href="index.html"><img class="img404" src="images/404.jpg" alt="404页面" /></a> </div> </body> </html>
相关推荐
冰蝶 2020-06-05
沈宫新 2020-02-23
gxyblue 2013-05-11
doyouhaveIET 2013-06-04
chenshuixian 2013-06-01
羽化大刀Chrome 2013-05-31
YoungForever 2013-04-04
tsolin 2013-07-13
vanturman 2014-12-08
dumarkee 2015-05-04
qiuzhiming0 2015-08-18
86477414 2015-08-20
阳光之吻 2015-05-15
wuxiaohui0 2014-01-03
xbworkspace 2016-11-24
fengkaiwhu 2014-03-19
JavaLab 2016-12-29
每天积累一点点 2014-11-13
icecoffeemzp 2015-03-03