1.利用margin的左右auto
<!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">
<!--
.container{
width:80%;
margin:0 auto;
background-color: #666666;
}
-->
</style>
</head>
<body>
<div class="container">container</div>
</body>
</html>
2.利用相对定位及负margin
<!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">
<!--
#container {
background-color: #666666;
position: relative;
width: 760px;
left: 50%;
margin-left: -380px;
min-width:400px;
}
-->
</style>
</head>
<body>
<div id="container">container</div>
</body>
</html>
3.其它方法:
https://blog.csdn.net/newbie_ling/article/details/78583655
https://blog.csdn.net/qq_28493675/article/details/79199125
https://blog.csdn.net/u011296285/article/details/78737380
https://blog.csdn.net/whuizhou/article/details/53784799
https://blog.csdn.net/liufeifeinanfeng/article/details/78615567