我一直在想其他人是如何使主要的div容器居中对齐的,到目前为止我唯一能做的就是在CSS文件中添加以下内容:
*{
padding:auto;
margin:auto;
text-align:centre;
}
我见过其他页面使用:*{padding:0px;margin:0px}
,但我看不到它们在哪里或者是如何将主容器居中。
有人能解释一下吗?
代码示例:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />
<title>This is the main container</title>
<style type="text/css">
*{
padding:auto;
margin:auto;
text-align:center;
}
</style>
</head>
<body>
<div style="width:400px;background-color:#66FFFF;display:block;height:400px;">
<b>This is the main container.</b>
</div>
</body>
</html>
有人可以解释一下以下页面是如何实现的吗?