<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript"></script>
<style type="text/css">
*{margin:0;padding:0;}
.div{margin:auto;border: solid 1px blue;}
.div{width: 500px;height: 500px;}
</style>
</head>
<body>
<div class="div">
</div>
</body>
</html>
如上 只需要设置margin为auto 便会水平居中 但是必须要设置宽度,这是我找到的最好的办法,不过不知道可以不可以在ie678中兼容