请问 div + css 布局的应用问题

来源:百度知道 编辑:UC知道 时间:2024/09/22 05:41:45
<!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'>
.top{
width:100%;
height:50px;
border:0 px double red;
background:url(images/monitor/monitor_bg.gif);
background-repeat:repeat-x;
margin: 0px;
padding: 0px;
margin-top:0px;
margin-left:0px;
background-color:#006600;
border:1;
}
.main{margin-top:0px; width:

.left{border:0px double red;width:270px;height:100%;background-color:#FF0000;z-index:9999; position:absolute; left:0; top:50px;}
改成:
.left{border:0px double red;width:270px;height:100%;background-color:#FF0000;z-index:9999; position:absolute; top:50px;}

定义蓝色的上下左右边距。宽为100%
因为left 和right都在main里,所以各自定义红色和蓝色相对于main的边距

帮你优化了一下结构什么的,感觉你写的太乱了,你看看是不是你要的效果?
完整代码如下:
<!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/c