怎么使网页居中啊,急求!帮我修改一下!
我按照网上的说法做了,说的使能居中,可是还是不能剧中呢?代码使这样写的
css中这样写的
body{
font:12px; font-family:"宋体"; text-align:center; margin:0px; padding:0px;background-color:#DAA520;
}
.container{
position:relative; width:770px; margin-left:auto; margin-right:auto; text-align:left; padding:0px;
<body>
<div class="container"></div>
</body> 我这里倒是居中了,不行在页首加个
<!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"> 请注意你里面的样式:
.container{
position:relative; width:770px; margin-left:auto; margin-right:auto; text-align:left; padding:0px;
}
这个里面的Margin错了。
应该写成:
Margin:0 auto;
这样DIV就肯定会居中了,这个事DIV的一个常识问题。
希望我的帖子会对你有帮助。 [quote][bo]以下是引用 [un]huangyong[/un] 在 2008-5-2 12:00 的发言:[/bo]
请注意你里面的样式:
.container{
position:relative; width:770px; margin-left:auto; margin-right:auto; text-align:left; padding:0px;
}
这个里面的Margin错了。
应该写成:
Margin:0 auto;
这样DIV就肯定 ... [/quote]
支持支持~~~ [quote][bo]以下是引用 [un]fengliang425[/un] 在 2008-5-4 09:05 的发言:[/bo]
支持支持~~~ [/quote]
我也支持支持 [quote][bo]以下是引用 [un]jimsonchoi[/un] 在 2008-5-6 22:22 的发言:[/bo]
我也支持支持 [/quote]
[tk02] 我也支持
页:
[1]
