一个完美的Div+CSS三列浮动布局代码

复制到记事本中,保存为.htm文件,就可以看到效果了.
一个完美的Div+CSS三列浮动布局代码


<!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">
<!--
body {
text-align: center;
}
#box {
width: 720px;
margin:0 auto;
text-align: left;
padding:0px;
}
#banner {
background-color: #f9f9f9;
height: 100px;
border: 1px solid #cccccc;
}
#main {
width: 520px;
float: right;
margin-top: 10px;
background-color: f9f9f9;
height: 200px;
border: 1px solid #cccccc;
}
#left_main {
height: 180px;
width: 320px;
float: left;
margin-top: 10px;
background-color: #f9f9f9;
border: 1px solid #cccccc;
}
#right_main {
background-color: #f9f9f9;
float: right;
height: 180px;
width: 180px;
margin-top: 10px;
border: 1px solid #cccccc;
}
#left {
float: left;
width: 180px;
height: 200px;
margin-top: 10px;
background-color: #f9f9f9;
border: 1px solid #cccccc;
}
#bottom {
clear: both;
height: 100px;
margin-top:10px;
border: 1px solid #cccccc;
background-color: #f9f9f9;
}
.HackBox {
border-top:1px solid transparent !important;
margin-top:-1px !important;
border-top:0;
margin-top:0;
clear:both;
visibility:hidden;
}
-->
</style>
</head>
<body>
<div id="box">
  <div id="banner">此处显示id为"banner"的内容</div>
  <div id="left">此处显示id为"left"的内容</div>
  <div id="main">
    <div id="left_main">此处显示id为"left_main"的内容</div>
    <div id="right_main">此处显示id为"right_main"的内容</div>
  </div>
  <div class="HackBox"></div>
  <div id="bottom">此处显示id为"bottom"的内容</div>
</div>
</body>
</html>
posted @ 2010-11-28 19:13  crid  阅读(251)  评论(0编辑  收藏  举报