<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> *{ padding: 0; margin: 0; } a{ text-decoration: none; } .comwidth{ width: 1000px; margin: 0 auto; } #top{ height: 60px; } .logo{ float: left; } .welcome{ float: left; font-size: 24px; line-height: 60px; } .welcome a{ color: #000; font-weight: bold; } .logo_a{ float: right; margin: 38px 0 10px 0; font-size: 14px; } .logo_a a{ color: #777; } #main{ height: 475px; background-color: #e80404; } .load{ border: 5px #ff0 solid; overflow: hidden; } .loadbox{ width: 350px; height: 300px; background-color: #fff; float: right; margin-top: 40px; } </style> </head> <body> <div id="box"> <div id="top" class="comwidth"> <p class="welcome"><a href="#">欢迎登陆</a></p> <p class="logo_a"><a href="#">登录页面,调查问卷 </a></p> </div> <div id="main"> <div class="comwidth load"> <div class="loadbox"> </div> </div> </div> </div> </body> </html>
请问为什么.load里写overflow: hidden;盒子不居中而去掉.load里的overflow: hidden;加在.comwidth里盒子就能居中
.comwidth {
width: 1000px;
margin: 0 auto;
overflow: hidden;
}
MarlboroKay