怎么让这段代码在网页上居中显示?

来源:百度知道 编辑:UC知道 时间:2024/05/30 11:06:56
<!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=gb2312" />
<title></title>
<style type="text/css">
.a {float:left; width:27px; height:47px; background-color:green;}
.b {float:left; width:870px; height:47px; background-color:blue;}
.c {float:left; width:21px; height:47px; background:red;}
</style>
</head>
<body>
<center>
<div class="a">
</div>
<div class="b">
</div>

<!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=gb2312" />
<title></title>
<style type="text/css">
.center{width:918px; margin-left:auto; margin-right:auto;}
.a {float:left; width:27px; height:47px; background-color:green;}
.b {float:left; width:870px; height:47px; background-color:blue;}
.c {float:left; width:21px; height:47px; background:red;}
.clear{
clear:both;
}
</style>
</head>
<body>
<div class="cente